6

私は次のことをしようとしています:

ここに画像の説明を入力

今のところ、NativeAndroid を使用しようとしています。

ただし、HTML と css でこれを行うことができます。

ご覧のとおり、次のようなものです。

  • 背景が青色のホルダー (他の色または IMAGE の可能性もあります)
  • (透明??)色のTextView
  • 背景が灰色の TextView

ただし、背景を灰色に設定し、テキストを透明に設定すると、テキストが「消え」、すべて灰色で表示されます。

これは私の試みです(ネイティブAndroid):

<RelativeLayout 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"
    android:background="#ff000000" >
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#ffcecece"
    android:padding="5dp"
    android:text="@string/hello_world"
    android:textColor="#00ffffff" />
</RelativeLayout>

ただし、次のことを示しています。

ここに画像の説明を入力

テキストがありますが、透明なので表示されません。

だから私の質問は:

  • どうすればこれを達成できますか?
  • キャンバス?スパン?私はそれらのアプローチに慣れていないので、いくつかの指示をいただければ幸いです。

ありがとう!!

編集: その青い背景は動的でなければならず、IMAGE である可能性があります!

4

3 に答える 3

0

Xml レイアウトではこれを実現できません。以下のように、レイアウトの背景とテキストの両方に同じ色を設定する必要があります。

<RelativeLayout 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"
    android:background="#0011ff" >
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#ffcecece"
    android:padding="5dp"
    android:text="@string/hello_world"
    android:textColor="#0011ff" />
</RelativeLayout>
于 2013-10-28T09:25:55.940 に答える