我正嘗試用這篇文章爲android應用程序創建初始屏幕:Splash Screens the Right Way。正如文章所說,我創建了具有兩層的LayerDrawable:背景位圖和徽標(也是位圖)。例如,徽標需要位於屏幕底部,縮進32dp。這裏我繪製:安卓半透明狀態欄,但非半透明導航欄(如果有)
<item
android:drawable="@drawable/splash_image" />
<item
android:id="@+id/logo"
android:bottom="@dimen/margin_splash">
<bitmap
android:gravity="bottom|center"
android:src="@drawable/logo_green" />
</item>
我指出這一點可繪製在我的飛濺活動主題android:windowBackground
PARAM。我還希望在支持此功能的設備上顯示啓動畫面時,透明狀態欄(API> = 19),因此我爲不同的android版本創建了兩個資源文件,並在values-v19 \ styles.xml中創建了兩個資源文件,我標記爲android:windowTranslucentStatus
這是真的。這裏我values/styles.xml
和values-v19/styles.xml
:
值/ styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/bg_splash</item>
</style>
</resources>
和
值-V19/styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/bg_splash</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
但在一些帶有軟導航欄Android設備我的標誌與它重疊。
我試圖指出android:windowTranslucentNavigation
標誌爲假但沒有成功。
是否有任何方法使Android軟件NavigationBar與透明狀態欄一起透明,或者我需要在我的splash活動的onCreate方法中檢測Soft NavigationBar可用性,並通過向NavigationBar的高度添加徽標的底部縮進來更新我的LayerDrawable?
感謝。