[英]no resource id found for app:layout_scrollflags from CollapsingToolbarLayout
[英]BottomAppBar And FloatingActionButton app:layout_scrollFlags behavior
我目前在布局中使用BottomAppBar和FloatingActionButton的組合(顯然在CoordinatorLayout內部):請參見布局:
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:backgroundTint="@color/primarycolor"
app:theme="@style/ThemeOverlay.MaterialComponents.Dark"
app:fabAlignmentMode="center"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIcon="@drawable/ic_menu_time" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways"
app:backgroundTint="#FFFF0000"
app:layout_anchor="@id/bar"
app:rippleColor="#FFFF8888"
app:srcCompat="@drawable/ic_fab_search" />
列表滾動的行為像BottomAppBar的魅力一樣起作用,但是FloatingActionButton有很大的問題。
正如您在下面的屏幕截圖中看到的那樣,BottomAppBar完全消失了,這真是棒極了,但是FAB卻無法做到這一點。 它只是在底部移動了一點。
知道我可以從哪里開始解決此問題嗎? 正確的行為是FAB跟隨大律師行而就消失了
在滾動之后:
您應該自己隱藏FAB。 只需調用fab.hide()
和fab.show()
即可管理其可見性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.