Android去標題時報錯:java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendan
来源:互联网 发布:windows更新出现问题 编辑:程序博客网 时间:2024/06/08 02:20
错误描述:java.lang.IllegalStateException: You need to use a theme.appcompat theme (or descendant) with this activity
产生原因:Activity继承自AppCompatActivity而不是Activity,在style.xml中使用了不兼容的Theme。
从错误提示中提到Theme.AppCompat theme,这是因为我们的activity一定是继承了兼容包中的类,
比如我这里就无意中继承了AppCompatActivity,它来自android.support.v7.app.AppCompatActivity。
所以就要使用与其配合的AppCompat的theme才行。
此時要隱藏標題欄方法是:
super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);getSupportActionBar().hide();
解决:1、使用AppCompat theme;
2、直接继承自Activity。
1 0
- Android去標題時報錯:java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendan
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this a
- eclipse:java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) wit
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant)
- Wireshark中The ntf is not running的问题
- nyoj 308 substring (最长逆序字符串)
- leetcode - Majority Element
- MAC 安装 brew
- 转载我感觉比较好的java线程的学习
- Android去標題時報錯:java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendan
- 排序和查找-基数排序 Radix Sorting
- Recyclerview用法浅析
- set resolution with direct show
- 小议Cookie和Session
- java中 创建对象时this调用基本数据类型
- SwipeListView滑动删除Android
- Source Insight 的使用
- Hello World入门