[英]BottomAppBar has a cradle (hole) when FloatingActionButton is hidden
[英]BottomAppBar FabCradleMargin becoming less, almost flat, when BottomAppBar returns from being hidden
我的 FabCradleMargin 在我的應用程序中導航並在 hideonScroll 設置為 true 時向上/向下滾動時,在底部應用程序欄中變得更少,幾乎平坦。 當BottomAppBar 從屏幕上隱藏時,它會在浮動操作按鈕下返回調整大小。 一定是新的 Android Material Components 中的一個小故障。 有沒有其他人遇到過這個問題。 如果是這樣,你有什么建議來修復它。
和
<com.google.android.material.bottomappbar.BottomAppBar
android:id="@+id/bar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
app:elevation="4dp"
app:fabAlignmentMode="center"
app:fabCradleRoundedCornerRadius="2dp"
app:hideOnScroll="true"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIcon="@drawable/ic_action_list" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/blue500"
app:fabSize="normal"
app:layout_anchor="@+id/bar"
app:tint="@color/white"
app:layout_anchorGravity="right"
app:srcCompat="@drawable/ic_select_camera" />
我也偶然發現了這個問題。 就我而言,這取決於我嘗試隱藏BottomAppBar
和FloatingActionButton
。 這是我的第一個(Kotlin):
private fun showBottomNavigationBar(barVisibility: Boolean, fabVisibility: Boolean) {
navView.visibility = if (barVisibility) BottomAppBar.VISIBLE else BottomAppBar.GONE
fab.visibility = if (fabVisibility) FloatingActionButton.VISIBLE else FloatingActionButton.GONE
}
這就是修復它的原因:
private fun showBottomNavigationBar(barVisibility: Boolean, fabVisibility: Boolean) {
navView.visibility = if (barVisibility) BottomAppBar.VISIBLE else BottomAppBar.GONE
if (fabVisibility) fab.show() else fab.hide()
}
因此,而不是隱藏的FloatingActionButton
與visibility屬性,我用了hide()
和show()
的方法FloatingActionButton
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.