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

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

        在给一个布局添加toolbar的时候出现一个错误

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

        这样在preview里面的确可以看出有2个actionBar



 

        于是只需要在声明这个Activity的时候说明一下NoActionBar就可以啦,具体操作是在AndroidManifest.xml中添加一行代码

 <activity android:name=".view.activity.TypeActivity"
            android:theme="@style/AppTheme.NoActionBar" ></activity>

 

相关内容推荐