美文网首页
怎样给Android去除标题栏

怎样给Android去除标题栏

作者: 樱桃小码媛 | 来源:发表于2017-10-22 19:50 被阅读0次

    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.

    相关文章

      网友评论

          本文标题:怎样给Android去除标题栏

          本文链接:https://www.haomeiwen.com/subject/hrdnuxtx.html