Ich versuche, eine schwebende Schaltfläche auf einem cardview ohne Erfolg zu verankern.Anker eine schwebende Schaltfläche auf einem cardview
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="8dp"
android:background="@android:color/white"
card_view:cardCornerRadius="2dp"
card_view:cardElevation="2dp">
..... my view ...
</android.support.v7.widget.CardView>
<android.support.design.widget.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:layout_anchor="@id/card_view"
app:layout_anchorGravity="bottom|end|right"
android:layout_margin="16dp"
android:clickable="true"/>
</LinearLayout>
Das Ergebnis ist wie folgt aus:
Ich möchte, dass Floating-Taste wie der grüne Kreis erscheinen. Dieses Layout wird in RecyclerView verwendet
Ist es ein Weg, dies zu erreichen?
Fügen Sie einfach diese Zeile in Ihrem FloatingActionButton android: layout_gravity = "center | bottom | right", Wenn es nicht funktioniert, ich helfe – Vadivel