backgroundレイアウトでビューの下にheaderビューを配置したいのですが、透明度があるため、ビューがビューと数ピクセルheader重なっています。background
z オーダーは XML ファイル内のビューの順序で決定されることがわかっているので、 with属性のheader下に を配置します。backgroundandroid:layout_above="@id/background"
しかし、両方の寸法を に設定したbackgroundためmatch_parent、headerは表示されません。
どうすれば私が望むものを達成できますか?
<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">
<RelativeLayout
android:id="@+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-5dp"
android:background="@drawable/bg" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_above="@id/background"
android:background="@drawable/bg_header" >
</RelativeLayout>
</RelativeLayout>