Android改变状态栏颜色导航不变
2015-07-20 10:44
519 查看
(1)
在你的activity oncreate 中添加
在你的activity oncreate 中添加
[code] getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintResource(R.color.actionbar_bg); } (2) 设置头部边距 contentView = getWindow().getDecorView().findViewById(android.R.id.content); contentView.setPadding(0,getStatusBarHeight(),0,0); (3)
public int getStatusBarHeight() { int result = 0; int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = getResources().getDimensionPixelSize(resourceId); } return result; }[/code]
相关文章推荐
- Android surfaceView(一)
- Android多种方式实现自定义Dialog对话框
- 使用命令启动android sdk manager
- Android ProgressDialog工具类
- android Shader绘图探究
- Android开发四大组件---Service详解
- Android安全--运行时验证签名
- Android学习之模拟器上面应用的sdcard的创建使用
- Android中新建的文件在R没有显示对应的文件解决办法总结
- 安卓自定义组合控件 android.view.InflateException: Binary XML file #23:error inflate
- android stdio出现的 问题
- 自定义View(三)Android圆环两个颜色交替出现的等待效果
- Android Studio中安装Genymotion插件解决方案
- Android Service 之三(Bind Service, 继承自 Binder 类)
- Android -- DiskLruCache
- 六款值得推荐的android开源框架简介
- Android开发学习笔记:Service的简介和启动方式
- android 截图保存位置不在已选择的“SD卡”中
- Android文件访问权限
- 推荐一本Android开发入门书籍