如何将floatingactionbutton置于布局的末尾

时间:2015-11-05 17:10:15

标签: android-layout floating-action-button

我想把我的浮动按钮放在相对布局底部的末端。我如何做到最好,最实用?

这是一个屏幕截图,它应该如何显示: enter image description here

2 个答案:

答案 0 :(得分:1)

如果您的父布局是相对布局。 只需使用

    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true"

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:orientation="vertical">



    <android.support.design.widget.FloatingActionButton
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true"
    android:id="@+id/myFAB"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_plus_sign"
    app:elevation="4dp"
 />

</RelativeLayout>

答案 1 :(得分:1)

此功能仅在您的父布局是协调员布局时才有效。这可以使用Object#tap[1,2,3] .map { |i| i * 2 } .tap { |i| puts i } .reduce(0) { |x, i| x += i }

来实现

有些事情是这样的:

app:layout_anchor=""

希望这有用。

相关问题