android隐藏标题栏个人心得,欢迎指正
来源:互联网 发布:悦诗风吟寒兰面霜知乎 编辑:程序博客网 时间:2024/06/10 01:15
1.依赖android-support-v7-appcompat
1.1 getSupportActionBar().hide();必须放在setContentView之前,这种只能解决单个activity的问题。public class MainActivity extends AppCompatActivity{@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);//去除标题栏getSupportActionBar().hide();setContentView(R.layout.activity_main);
1.2 把parent改变一下,另外再加一个item“windowNoTitle”,application节点下的them不用改变, 也可以自定义style,但做法跟这个一样,只不过名字换了。但是这种在6.0系统上,我感觉黑色的字体变浅了 ,不知道咋回事,求大神告知<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar"> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> <item name="windowNoTitle">true</item> </style>
<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">>
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar"> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> <item name="windowNoTitle">true</item> </style>
<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme">>
2.不依赖android-support-v7-appcompat
2.1,这种的话网上很多,基本都对
@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);//去除标题栏this.requestWindowFeature(Window.FEATURE_NO_TITLE);
2.2,在style下多加个item,其余不变<style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> <item name="windowNoTitle">true</item> </style>
2.3,在application节点下的theme主题换下<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar">
0 0
- android隐藏标题栏个人心得,欢迎指正
- android 隐藏标题栏、隐藏状态栏
- Android隐藏标题栏
- android 隐藏标题栏
- Android隐藏标题栏、状态栏
- Android 标题栏、状态栏隐藏
- android 隐藏标题栏
- android 隐藏标题栏
- android 隐藏标题栏
- android 隐藏标题栏
- Android studio隐藏标题栏
- Android-无法隐藏标题栏
- android 隐藏标题栏
- Android 标题栏、状态栏隐藏
- Android开发 隐藏标题栏
- Android 隐藏,显示标题栏
- Android隐藏标题栏
- android如何隐藏标题栏
- FIRST集与FOLLOW集
- 12月你好!
- mac 终端 常用命令
- OpenCV 3 新特性
- 好书推荐
- android隐藏标题栏个人心得,欢迎指正
- Android获取view某个坐标的颜色值,更改状态栏颜色
- Linux svn服务器的存放路径和文件详解
- linux下安装c语言支持的thrift
- C#连接MySql数据库
- selenium python 遇到的问题
- EL和jquery中的$
- 帝国CMS综合文档
- PlayReady 和WideVine