我的應用程式有minSdkVersion 21和targetSdkVersion 31。我希望在狀態欄上繪制導航抽屜,但僅當它處于打開狀態時。
這是當導航抽屜關閉時應用程式現在的樣子,這就是我想要的樣子:

但問題是當我打開抽屜時:

狀態欄覆寫了它的一部分,我希望抽屜被繪制在狀態欄上。
目前,我在主要活動布局中有:
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@ id/drawer_layout"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
...
在themes.xml:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
我怎樣才能實作所需的行為?我嘗試了不同的方法,但這里的方法最接近我想要的方法。除了描述的小細節。
uj5u.com熱心網友回復:
進一步研究該主題后發現,我想在帖子中實作的目標沒有意義,因為許多手機在狀態欄中間都有一個攝像頭區域,并將導航抽屜渲染在狀態欄頂部狀態欄會使它的一部分被相機孔覆寫。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/403851.html
標籤:
