如何将按钮一半放在 cardview 上,一半放在父布局上
How can I place a button half on cardview and half on parent layout
这是我试过的。但是按钮出现在卡片下方。有人能告诉我如何让按钮在卡片上方可见吗?这表示回收站视图中的一行。
<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"
xmlns:card_view="http://schemas.android.com/apk/res-auto">
<Button
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
/>
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/pList"
card_view:cardElevation="2sp"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginLeft="10dp"
>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
将按钮和卡片位置交换到此 xml 布局文件中。您还应该为按钮设置高度,例如 4dp。`
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/pList"
card_view:cardElevation="2sp"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginLeft="10dp"
>
</RelativeLayout>
</android.support.v7.widget.CardView>`
<Button
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:elevation="4dp"
/>
这是我试过的。但是按钮出现在卡片下方。有人能告诉我如何让按钮在卡片上方可见吗?这表示回收站视图中的一行。
<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"
xmlns:card_view="http://schemas.android.com/apk/res-auto">
<Button
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
/>
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/pList"
card_view:cardElevation="2sp"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginLeft="10dp"
>
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
将按钮和卡片位置交换到此 xml 布局文件中。您还应该为按钮设置高度,例如 4dp。`
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/pList"
card_view:cardElevation="2sp"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginLeft="10dp"
>
</RelativeLayout>
</android.support.v7.widget.CardView>`
<Button
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:elevation="4dp"
/>