我正尝试用这篇文章为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?
感谢。