我试图将FAB按钮附加到底部视图视图,如Google地图。但是我不能让它工作,Android无法将FAB按钮锚定到底部图片
这是FAB按钮的代码:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email"
app:layout_anchor="@+id/nestedscrollview" --> BottomSheet view ID
app:layout_anchorGravity="bottom|end"
app:elevation="4dp"
/>
,这是的BottomSheet查看
<android.support.v4.widget.NestedScrollView
android:id="@+id/nestedscrollview"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
tools:context="com.pub.uac.ui.location.LocationActivity"
android:background="@color/background_white_trasnparent"
>
...
</...
在github上试试这个例子.............. https://github.com/chrisbanes/cheesesquare –
我也在尝试同样的事情吗? – sector11
还没有,仍然试图找出如何挂钩ID –