自訂底部導覽檢視
重要
本文說明 處於公開預覽 狀態的功能和指引,而且可能會在正式推出之前大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
BottomNavigationView
是BottomNavigationView,可以偵測折迭功能,並將其子檢視放在左邊或右邊。
displayPosition - 決定要在哪個螢幕上呈現檢視。 可以是下列三個值的其中一個:
您可以使用 app:display_position
屬性來取得相同的結果:
<com.microsoft.device.dualscreen.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/bottom_nav_menu"
tool:tools_application_mode="dual_screen"
.....
app:display_position="start"
/>
arrangeButtons - 當應用程式跨越折迭功能,而元件有奇數的按鈕時,如果裝置有實體轉軸) ,中間的按鈕將會由轉軸 (涵蓋。 避免這種情況的其中一種方法,就是在每個螢幕上以不同的方式排列按鈕:
useTransparentBackground - 當應用程式跨越整個螢幕寬度且元件部分不包含任何按鈕時,該部分畫面的背景可以變成透明:
useAnimation - 判斷當按鈕排列變更時是否使用動畫。 根據預設, AccelerateDecelerateInterpolator
將會使用 。 透過 animationInterpolator 屬性的協助,可以將其變更為任何其他內插運算。
bottomNavigationView.useAnimation = true
bottomNavigationView.animationInterpolator = OvershootInterpolator()
allowFlingGesture - 如果設定為 true
,displayPosition 可以設定為 DisplayPosition.START 或 DisplayPosition.END,並在元件上具有飛出手勢。