Android 视图组剪辑子对象不能设置为false

Android 视图组剪辑子对象不能设置为false,android,android-layout,viewgroup,clip,Android,Android Layout,Viewgroup,Clip,我正在尝试实现一种可刷卡效果,就像应用程序Tinder一样: 当我刷卡时,即使我将clipchildren和cliptopadding设置为false,子视图也总是被其容器剪切。知道为什么吗 CardStack是我的自定义容器布局 xml: android:clipToPadding=“false” android:layout_weight=“3” / 刷卡前 滑动后,将剪裁子视图的按钮:( ----------------编辑----------------------- 我发现问

我正在尝试实现一种可刷卡效果,就像应用程序Tinder一样:

当我刷卡时,即使我将clipchildren和cliptopadding设置为false,子视图也总是被其容器剪切。知道为什么吗

CardStack是我的自定义容器布局 xml:


android:clipToPadding=“false”
android:layout_weight=“3”
/
刷卡前

滑动后,将剪裁子视图的按钮:(

----------------编辑-----------------------

我发现问题在于,在线性布局中,最后一个子项总是显示在顶部(较大的z索引)。因此,即使cardstack容器不剪裁子项,其子项仍然显示在下面的下一个视图下方。因此,最好切换到相对布局


但我真的不想这样做,因为RelativeLayout没有一个很好的“布局权重”功能来指定高度百分比。所以情况是,我想要一种方法来轻松控制z索引(对于线性布局来说这是不可能的),并且还想保留“布局权重”功能(似乎只有线性布局才可行).有什么想法吗???

为什么需要布局权重?我假设俯视图占据了所有可用空间?现在您正在将屏幕划分为四分之一,但如果您可以在其中任何一个视图上设置大小,问题就解决了

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <RelativeLayout
        android:id="@+id/button_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="@dimen/large_bottom_padding"
        android:background="#FF00FF"
        >
        <Button
            android:layout_centerHorizontal="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="B"
            android:id="@+id/info"
            />
        <Button
            android:id="@+id/like"
            android:layout_toLeftOf="@+id/info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="A"
            />
        <Button
            android:id="@+id/dislike"
            android:layout_toRightOf="@+id/info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="C"
            />

    </RelativeLayout>

    <com.wenchao.cardstack.CardStack
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"         <!-- Not really important -->
        android:layout_alignParentTop="true"         <!-- Because of these lines -->
        android:layout_above="@id/button_container"  <!-- Because of these lines -->
        android:padding="20dp"
        android:clipChildren="false" <!--- false -->
        android:clipToPadding="false"
        />

</RelativeLayout

android:layout\u alignParentTop=“true”
android:layout_over=“@id/button_容器”
android:padding=“20dp”
android:clipChildren=“false”
android:clipToPadding=“false”
/
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <RelativeLayout
        android:id="@+id/button_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="@dimen/large_bottom_padding"
        android:background="#FF00FF"
        >
        <Button
            android:layout_centerHorizontal="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="B"
            android:id="@+id/info"
            />
        <Button
            android:id="@+id/like"
            android:layout_toLeftOf="@+id/info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="A"
            />
        <Button
            android:id="@+id/dislike"
            android:layout_toRightOf="@+id/info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="C"
            />

    </RelativeLayout>

    <com.wenchao.cardstack.CardStack
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"         <!-- Not really important -->
        android:layout_alignParentTop="true"         <!-- Because of these lines -->
        android:layout_above="@id/button_container"  <!-- Because of these lines -->
        android:padding="20dp"
        android:clipChildren="false" <!--- false -->
        android:clipToPadding="false"
        />

</RelativeLayout