【发布时间】:2016-03-15 04:44:38
【问题描述】:
我一直在为我的 FAB 的位置而苦苦挣扎,此时,由于未知原因(对我而言),该按钮位于左上角,而它应该位于右下角。
这是我的代码:
<RelativeLayout 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"
android:background="@color/l_gray"
android:weightSum="1">
<ListView
android:id="@+id/lv_vehiculos"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_margin="0dp"
android:divider="@color/transparent"
android:dividerHeight="15dp"
android:layout_weight="0.83"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true" />
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:layout_marginBottom="0dp"
android:clickable="true"
android:src="@drawable/icon_white_plus"
app:backgroundTint="@color/s_gray"
app:borderWidth="0dp"
app:elevation="2dp"
android:id="@+id/view" />
这就是结果。
【问题讨论】:
标签: android user-interface layout material-design floating-action-button