如何在最后放置FAB |剩下?

时间:2017-09-04 14:09:42

标签: android android-layout floating-action-button

如何在RTL中从右向左更改FAB?问题是FAB无法改变RTL中的位置

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:padding="20dp">

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="false"
        android:layout_gravity="left|end"
        android:layout_marginBottom="16dp"
        android:layout_marginRight="16dp"
        app:backgroundTint="@color/colorPrimary"
        app:borderWidth="0dp"
        app:elevation="8dp"
        app:fabSize="normal"
        app:srcCompat="@drawable/add_icon" />


</RelativeLayout>

I want the FAB as like in the image

1 个答案:

答案 0 :(得分:0)

将此添加到浮动按钮xml

android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"