1、在setContentView(R.layout.activity_main);之前添加getSupportActionBar().hide();只消除当前Activity的标题栏
2、在setContentView(R.layout.activity_main);之前添加requestWindowFeature(Window.FEATURE_NO_TITLE);并将AppCompatActivity改为Activity,只消除当前Activity的标题栏
修改主题消除整个应用的所有标题栏我试了没好用,错误代码如下,还希望知道原因的小伙伴指教一下~
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.administrator.clouddiary/com.example.administrator.clouddiary.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
网友评论