您的位置:首页 > 移动开发

继承AppCompatActivity 移除ActionBar的两种方法

2017-06-12 16:55 411 查看
  如果不想用系统自带的ActionBar,而你的Activity继承了AppcompatActivity的话,有两种方法:

 1,代码实现:

ActionBar actionBar=getSupportActionBar();
actionBar.hide();

2,style 实现,首先写一个style:

<style name="xxxxx" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:fitsSystemWindows">true</item>
</style>

xxx是你自定义的名字,然后在manifest文件中对应的Activity中引用该style:

android:theme="@style/xxxxx"

这样就ok了。

  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ui