toolbar使用问题

来源:互联网 发布:美国下饺子知乎 编辑:程序博客网 时间:2024/05/17 07:02

1.使用页面应当继承与AppCompatActivity


2.如果使用的时候出现如下报错:

java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.

修改style如下:

<resources>    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">        <!-- Customize your theme here. -->    </style></resources>


0 0