锚定Fab按钮

时间:2018-01-01 05:23:26

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

如何将fab锚定在下面附带图像中的红色标记位置。任何帮助表示赞赏。另请访问此git hub链接以建议更改。 Github link

Image for reference

2 个答案:

答案 0 :(得分:1)

As per my above comment

只需从 FloatingActionButton

中删除android:layout_margin="@dimen/fab_margin"即可 像这样

<android.support.design.widget.FloatingActionButton
                android:id="@+id/share_fab"
                android:layout_width="@dimen/fab_width"
                android:layout_height="@dimen/fab_height"
                android:clickable="true"
                app:rippleColor="@color/secondaryDarkColor"
                android:contentDescription="@string/action_share"
                android:src="@drawable/ic_share"
                app:borderWidth="0dp"
                app:elevation="@dimen/fab_elevation"
                app:layout_anchor="@id/meta_bar"
                app:layout_anchorGravity="right|bottom" />

答案 1 :(得分:0)

<android.support.design.widget.FloatingActionButton
            android:id="@+id/share_fab"
            android:layout_width="@dimen/fab_width"
            android:layout_height="@dimen/fab_height"
            android:clickable="true"
            app:rippleColor="@color/secondaryDarkColor"
            android:contentDescription="@string/action_share"
            android:src="@drawable/ic_share"
            app:borderWidth="0dp"
            android:layout_marginLeft="700dp"
            app:elevation="@dimen/fab_elevation"
            app:layout_anchor="@id/meta_bar"
            app:layout_anchorGravity="bottom"
            tools:ignore="RtlHardcoded" />

我这样做了。