1、隐藏Actionbar

代码中设置:requestWindowFeature(Window.FEATURE_NO_TITLE)     //如果Activity是继承自AppCompatActivity的话,这代码会失效。。。。

样式中修改:

  <style name="AppTheme.Base" parent="Theme.AppCompat">
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
  </style>

一开始可能会使用如下写法,会报错 AppCompat does not support the current theme features,还是建议直接使用sdk内置的NoActionbar样式

  <style name="AppTheme.Base" parent="Theme.AppCompat">
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
  </style>

2、替换成Toolbar

   toolbar= (Toolbar) findViewById(R.id.toolbar);
   setSupportActionBar(toolbar);

3、颜色控件设置

偷懒了,给个传送

 

注意:当设置点击事件的时候一定要设置在在setSupportActionBar()之后才能生效

 

posted on 2016-08-31 13:59  向着大牛奋斗  阅读(215)  评论(0编辑  收藏  举报