我有一个浮动动作按钮应该在右下角,但显然重力不工作。它显示在左上角。这里是我的代码:浮动动作按钮重力不工作
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/rl"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@mipmap/ic_action_send"
app:backgroundTint="@color/colorPrimaryDark"
app:layout_anchor="@id/iv"
app:layout_anchorGravity="bottom|right|end"/>
</RelativeLayout>
谢谢,这并获得成功。 –