如何在android中创建fab over cardview布局?如何在android中避免cardview背后的fab?

如何在android中创建fab over cardview布局?如何在android中避免cardview背后的fab?,android,xml,Android,Xml,我想为浮动操作按钮和CardView创建一个布局。问题是浮动操作按钮隐藏在cardview的后面,我尝试使用RelativeLayout,但没有使用cardview上的fab,我需要一些建议 使用协调器布局而不是相对布局,并为fab底部|末端设置布局是否尝试设置高程? 如果卡的标高大于晶圆厂的标高,它将覆盖该标高 (只是一个建议,但尽量不要使用中断的库。)不幸的是,它不起作用,而我正在尝试协调布局而不是相对布局。晶圆厂仍然位于卡片的后面。当一半的内容充满了意图时,晶圆厂就会工作。但是,晶圆厂的

我想为浮动操作按钮和CardView创建一个布局。问题是浮动操作按钮隐藏在cardview的后面,我尝试使用RelativeLayout,但没有使用cardview上的fab,我需要一些建议



使用协调器布局而不是相对布局,并为fab底部|末端设置布局是否尝试设置高程? 如果卡的标高大于晶圆厂的标高,它将覆盖该标高


(只是一个建议,但尽量不要使用中断的库。)

不幸的是,它不起作用,而我正在尝试协调布局而不是相对布局。晶圆厂仍然位于卡片的后面。当一半的内容充满了意图时,晶圆厂就会工作。但是,晶圆厂的位置完全隐藏了更多的卡片。你也改变了晶圆厂容器的高度吗?它是否适用于普通晶圆厂?我的意思是不是一个自定义的fap,一个从支持库。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:fab="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity"
<android.support.v7.widget.CardView
android:id="@+id/card1"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_margin="6dp"
app:cardElevation="8dp"
android:layout_centerHorizontal="true"
app:contentPadding="15dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Card 1"
android:layout_marginTop="40dp"
android:textColor="@color/colorPrimaryDark"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="bold"/>
</android.support.v7.widget.CardView
<android.support.v7.widget.CardView
android:id="@+id/card2"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_margin="6dp"
app:cardElevation="8dp"
android:layout_below="@id/card1"
android:layout_centerHorizontal="true"
app:contentPadding="15dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Card 2"
android:layout_marginTop="40dp"
android:textColor="@color/colorPrimaryDark"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="bold"/>
</android.support.v7.widget.CardView
<android.support.v7.widget.CardView
android:id="@+id/card3"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_below="@id/card2"
android:layout_margin="6dp"
app:cardElevation="8dp"
android:layout_centerHorizontal="true"
app:contentPadding="15dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Card 3"
android:layout_marginTop="40dp"
android:textColor="@color/colorPrimaryDark"
android:textAlignment="center"
android:textSize="20sp"
android:textStyle="bold"/>
</android.support.v7.widget.CardView
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:paddingRight="10dp"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
fab:menu_labels_ellipsize="end"
fab:menu_labels_singleLine="true"
app:menu_icon="@drawable/fab_add"
fab:menu_backgroundColor="#ccffffff"
fab:menu_fab_label="Options"
app:menu_colorNormal="@color/colorAccent"
android:elevation="2dp"
<com.github.clans.fab.FloatingActionButton
android:id="@+id/id_share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/share"
android:padding="5dp"
fab:fab_size="mini"
fab:fab_label="Share"
app:rippleColor="@color/colorAccent"
app:fab_colorNormal="@color/colorAccent"/
<com.github.clans.fab.FloatingActionButton
android:id="@+id/id_copy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/share"
android:padding="5dp"
fab:fab_size="mini"
fab:fab_label="Copy"
app:rippleColor="@color/colorAccent"
app:fab_colorNormal="@color/colorAccent"/>
</com.github.clans.fab.FloatingActionMenu>
</RelativeLayout>