android状态栏透明适配以及状态栏不占位置的问题
2017-05-20 11:43
483 查看
将状态栏设置成透明并且兼容android4.4版本,见一下代码
并且需要设置style <item
name="android:windowTranslucentStatus">true</item>
这样设置之后发现状态栏不占位置了,在布局时很尴尬,需要用到在android studio中引用
compile
'com.readystatesoftware.systembartint:systembartint:1.0.3'
详情可以见网址
SystemBarTint地址: https://github.com/hexiaochun/SystemBarTint
此网址中有详细的介绍和说明
修改之后这样基本就可以了,状态栏也会占位置,其中关于状态栏沉浸式还可以参考以下网址
http://www.open-open.com/lib/view/open1455584716230.html
private void InitWindow() { Window window = getWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } }
并且需要设置style <item
name="android:windowTranslucentStatus">true</item>
这样设置之后发现状态栏不占位置了,在布局时很尴尬,需要用到在android studio中引用
compile
'com.readystatesoftware.systembartint:systembartint:1.0.3'
详情可以见网址
SystemBarTint地址: https://github.com/hexiaochun/SystemBarTint
此网址中有详细的介绍和说明
private void InitWindow() { Window window = getWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); // set a custom tint color for all system bars tintManager.setTintColor(Color.parseColor("#EC3F53")); }
修改之后这样基本就可以了,状态栏也会占位置,其中关于状态栏沉浸式还可以参考以下网址
http://www.open-open.com/lib/view/open1455584716230.html
相关文章推荐
- android5.x以上 状态栏透明的问题
- Android 设置透明状态栏后,EditText被软键盘挡住问题
- Android沉浸式(透明)状态栏适配
- Android 6.0+ RecyclerView嵌套在ScrollView显示不全以及Android 7.0+ PopupWindow位置显示不对的问题解决
- android 透明状态栏方法及其适配键盘上推(一)
- Android 7.0 PopupWindow弹出位置的适配问题
- 初学者---Android 沉浸式(透明)状态栏适配
- Android实现透明状态栏方法以及改变状态栏文字颜色
- Android 沉浸式状态栏以及 透明状态栏 和修改状态栏颜色
- Android开发之透明导航栏状态栏后与软键盘产生冲突的问题解决
- Android开发ViewPager的预加载和Fragment的销毁问题,以及tabLayout+ViewPager的使用,tablayout平板适配问题解决
- Android上透明状态栏,全屏显示以及沉浸模式
- Android 沉浸式状态栏实现,以及遇到的问题
- android 全屏以及透明状态栏总结
- android 关于状态栏的设置,修改,适配的问题包括:4.x,5.x,6.x的手机的适配
- Android 版本更新(非热更新) 适配7.0更新 以及三星 note系列读取内存相关目录无权限问题
- Android 沉浸式状态栏(透明)适配
- Android WebView加载Html文本不能适配,以及图片中间有空白的问题
- Android 4.4 以及 5.0以上 透明状态栏
- Android照相机捕获照片保存大小以及保存位置的问题