Android 安卓:为什么属性clipChildren不';在相对布局中不起作用,但在线性布局中起作用
我很困惑为什么属性clipChildren在RelativeLayout中不起作用,而在LinearLayout中起作用。 我把一个线性布局和一个相对论放在一个父母相对论中。并将clipChildren设置为这三种布局中的“false”。但它显示出不同。 代码如下:Android 安卓:为什么属性clipChildren不';在相对布局中不起作用,但在线性布局中起作用,android,android-layout,Android,Android Layout,我很困惑为什么属性clipChildren在RelativeLayout中不起作用,而在LinearLayout中起作用。 我把一个线性布局和一个相对论放在一个父母相对论中。并将clipChildren设置为这三种布局中的“false”。但它显示出不同。 代码如下: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:clipChildren="false"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:clipChildren="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:clipChildren="false"
android:clipToPadding="false"
android:background="#ff0000"
android:layout_marginTop="200dp"
android:layout_width="100dp"
android:layout_height="200dp">
<Button
android:background="@color/colorPrimaryDark"
android:layout_width="300dp"
android:layout_height="100dp" />
</LinearLayout>
<RelativeLayout
android:clipChildren="false"
android:clipToPadding="false"
android:background="#ff0000"
android:layout_width="100dp"
android:layout_height="200dp">
<Button
android:background="@color/colorPrimaryDark"
android:layout_width="300dp"
android:layout_height="100dp" />
</RelativeLayout>
</RelativeLayout>
结果如下: