This Activity already has an action bar supplied by the window decor.

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

提示這個錯誤的時候,只需要在配置文件中,找到對應的activity的設置其樣式爲:


           android:theme="@style/AppTheme.NoActionBar">


如果沒有成功的話可以在Android的styles.xml中配置如下的命令即可:


    <style name="AppTheme.NoActionBar">
         <item name="windowActionBar">false</item>
         <item name="windowNoTitle">true</item> 
    </style>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章