网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

android状态栏怎么设置透明

时间:2024-10-23 19:42:15

1、在Style.xml文件中设置:<item name="android:windowTranslucentStatus">true</item> //透明的状态栏 <item name="android:windowTranslucentNavigation">true</item>//透明的导航图 <item name="android:fitsSystemWindows">true</item>//设置应用布局时是否考虑系统窗口布局

android状态栏怎么设置透明

3、使用代码设置(判断当前SDK是否大于19,推荐使用代码设置)//判断SDK版本是否大于等于4.4 因为该属性只有19版本才能设置if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes(); localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);}

android状态栏怎么设置透明
© 2025 小知经验
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com