android 导航栏半透明,Android半透明状态栏但非半透明导航栏(如果有)

I'm trying to create splash screen for android application with this article: Splash Screens the Right Way. As article says, I created LayerDrawable with two layers: background bitmap and logo (also bitmap). Logo need to be located at the bottom of screen with indent 32dp, for example. Here my drawable:

我试图用这篇文章为Android应用程序创建启动画面:Splash Screens正确的方法。正如文章所说,我创建了两层LayerDrawable:背景位图和徽标(也是位图)。例如,徽标需要位于屏幕底部,缩进32dp。在这里我的绘画:

android:drawable="@drawable/splash_image" />

android:id="@+id/logo"

android:bottom="@dimen/margin_splash">

android:gravity="bottom|center"

android:src="@drawable/logo_green" />

I pointed this drawable as android:windowBackground param in my splash activity theme. I also want to have transparent status bar when splash screen is shown on devices where this feature is supported (API >=19), so I created two resource files for different android versions and in values-v19\styles.xml I pointed flag android:windowTranslucentStatus as true. Here my values/styles.xml and values-v19/styles.xml:

我在我的splash活动主题中将这个drawable指向android:windowBackground param。当支持此功能的设备上显示启动画面时,我也想要透明状态栏(API> = 19),所以我为不同的Android版本和值创建了两个资源文件-v19 \ styles.xml我指向了标志android :windowTranslucentStatus为true。这里是我的values / styles.xml和values-v19 / styles.xml:

values/styles.xml

@drawable/bg_splash

and

values-v19/styles.xml

@drawable/bg_splash

true

But on some Android devices with Soft NavigationBar my logo is overlapped by it. e13d5d84009b454bfa9ca590a8261394.jpe

I tried to point android:windowTranslucentNavigation flag as false but without success.

但是在一些带有Soft NavigationBar的Android设备上,我的徽标与它重叠。我试图将android:windowTranslucentNavigation标记为false,但没有成功。

Is any way to make Android Soft NavigationBar transparent together with transparent status bar, or I need detect Soft NavigationBar availability in onCreate method of my splash activity and update my LayerDrawable by adding bottom indent for logo to the height of NavigationBar?

有没有办法让Android Soft NavigationBar与透明状态栏一起透明,或者我需要在我的splash活动的onCreate方法中检测Soft NavigationBar可用性,并通过在NavigationBar的高度添加徽标的底部缩进来更新我的LayerDrawable?

Thanks.

2 个解决方案

#1

0

Did you try this?

你试过这个吗?

@android:color/transparentfalsefalse

Also you can a little bottom padding to your bitmap item in the layer drawable.

此外,您可以在图层drawable中对您的位图项进行一点底部填充。

#2

0

I encountered the same problem and solved this problem by setting the following attributes.

我遇到了同样的问题,并通过设置以下属性解决了这个问题。

false

This attributes is set to values-v21 directory.

此属性设置为values-v21目录。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值