RelativeLayout
背の高い赤を含む黄色がありLinearLayout
ます。
全体をLinearLayout
見えるようにするために、 を設定android:clipChildren="false"
しましたが、期待どおりに動作しません:
<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="44dp"
android:background="#FFFF00"
android:clipChildren="false" >
<LinearLayout
android:layout_width="50dp"
android:layout_height="100dp"
android:background="#FF0000"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
- と
android:clipChildren="true"
:
期待どおりに赤がLinearLayout
切り取られた
- と
android:clipChildren="false"
:
高さがLinearLayout
切り取られ、レイアウトで設定された幅が考慮されません。
どうしたの?
編集
親と一致する両方の寸法でコンテナーをラップするLinearLayout
と、同じ結果が得られます (LinearLayout コンテナーのコンテナーが画面全体を占めることを確認しました)。
<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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="#FFFF00"
android:clipChildren="false" >
<LinearLayout
android:layout_width="50dp"
android:layout_height="100dp"
android:background="#FF0000"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
</LinearLayout>
編集2
android:clipChildren="false"
親 LinearLayout に属性を配置すると、次のようになります。