android状态栏透明

8386983E-7002-4536-89EE-5608B63FD51D.png (222.18 KB, 下载次数: 0)

下载附件  保存到相册

2 小时前 上传


实现步骤:
1、下载第三方开源库https://github.com/jgilfelt/SystemBarTint(注意事项,V19以上才会出现透明
2、项目目录res下新建values-v19文件夹,添加style.xml文件,内容如下

<resources>

    <!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar.TranslucentDecor">
        <!-- Customize your theme here. -->
</style>

</resources>


3、Activity中设置状态栏透明,显示根布局的背景图片


 

跳转到指定楼层
楼主
发表于 1 小时前 | 只看该作者 | 只看大图 评论奖励 | 倒序浏览 | 阅读模式
本帖最后由 ~手拍黄瓜~ 于 2015-12-23 09:52 编辑

废话少说上效果图:

8386983E-7002-4536-89EE-5608B63FD51D.png (222.18 KB, 下载次数: 0)

下载附件  保存到相册

2 小时前 上传


实现步骤:
1、下载第三方开源库https://github.com/jgilfelt/SystemBarTint(注意事项,V19以上才会出现透明
2、项目目录res下新建values-v19文件夹,添加style.xml文件,内容如下

<resources>

    <!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar.TranslucentDecor">
        <!-- Customize your theme here. -->
</style>

</resources>

3、Activity中设置状态栏透明,显示根布局的背景图片

3AF744C3-E763-46D3-94E9-A6FBDF45EA4B.png (78.56 KB, 下载次数: 0)

下载附件  保存到相册

2 小时前 上传



//调整根布局如下属性
android:fitsSystemWindows="true"
android:clipToPadding="true"
//设置根布局背景
android:background="@mipmap/bg"
-----------------------------------------------------------设置状态栏透明结束,我是分割线----------------------------------------------------------------

另外,如果要在Activity中设置状态栏颜色,onCreate中调用改方法即可

/**
* setSystemTintBar
*           设置状态栏颜色
* */

3AF744C3-E763-46D3-94E9-A6FBDF45EA4B.png (78.56 KB, 下载次数: 0)

下载附件  保存到相册

2 小时前 上传

protected void setSystemTintBar(){
   // create our manager instance after the content view is set
   tintManager = new SystemBarTintManager(this);
   // enable status bar tint
   tintManager.setStatusBarTintEnabled(true);
   // enable navigation bar tint
   tintManager.setNavigationBarTintEnabled(true);
   // set a custom tint color for all system bars
   tintManager.setStatusBarTintColor(getResources().getColor(R.color.navigation_bar_bg));
}




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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值