Viewの高さがTextViewの高さになる半透明の赤いViewとTextViewをRelativeLayout内に作成しようとしましたが、半透明の赤表示:android:layout_alignTopはandroid:layout_alignBottomと似ていません
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:background="#FF0000"
android:alpha="0.5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/textView"/>
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TEST"
android:textSize="50dp"
android:textColor="#000000"/>
</RelativeLayout>
が、私はそれを少し変更したい:のTextViewの上に表示を入れて、他の人が変更されないまま、私はandroid:layout_alignTop
に変更android:layout_alignBottom
を試してみました:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:background="#FF0000"
android:alpha="0.5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/textView"/>
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TEST"
android:textSize="50dp"
android:textColor="#000000"/>
</RelativeLayout>
が、今View
がTextView
の高さに従っていないようです:
何が問題で、どのように私はそれを修正することができますか?
xmlだけではできないと思います。 'TextView'の上に' View'を置く必要がある場合、その高さの位置合わせを行うことはできません。 – BakaWaii