2

私はこれに少し立ち往生しています。FrameLayout 内に ImageView と TextView があり、ImageView の上にテキストを含むカスタマイズされたバナーを作成しようとしています。textview を斜めおよび左または右にする方法がわかりません。これは、私がやろうとしていることを表現するために見つけることができる最も近いものです (ただし、独自のカスタムテキストを使用):

ここに画像の説明を入力

これを行うための簡単で効率的な方法はありますか?

ここに私の現在のxmlがあります:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ImageView
            android:id="@+id/icon"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#000000"
            android:ellipsize="none"
            android:text="TextView"
            android:textColor="#ffffff" />

    </FrameLayout>

</LinearLayout>

編集:テキストを動的に変更したくないことに注意してください。

4

1 に答える 1

0

ApiDemos サンプル プロジェクトをご覧になることをお勧めします。パスに沿ってテキストを描画するサンプルがあります。com.example.android.apis.graphics.TextAlign.java

于 2012-08-23T19:32:38.203 に答える