【发布时间】:2016-04-30 17:31:10
【问题描述】:
我正在尝试像 Google 地图一样将 FAB 按钮附加到 BottomSheet 视图。但是我不能让它工作,
这是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 上试试这个例子........github.com/chrisbanes/cheesesquare
-
我也在尝试同样的事情,你解决了吗?
-
还没有,还在想办法钩ID
-
我在这里发布了一个问题,让我们看看会发生什么...stackoverflow.com/questions/36985403/…
标签: android button floating-action-button