Failed to resolve attribute at index 6
来源:互联网 发布:英语发音 知乎 编辑:程序博客网 时间:2024/06/05 14:31
是什么
用 Android Studio 创建了 5.0 的应用,给默认的 Activity 修改主题,从
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">--></style>
改为:
<style name="AppTheme" parent="android:Theme.Material"></style>
就先后报了:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.Failed to resolve attribute at index 6
这两个错误。
为什么
因为 Android Studio 创建工程时默认创建的 Activity extends AppCompatActivity,AppCompatActivity 是 v7 兼容包下的类,自然必须用 v7 包中的主题。而 style 默认的 Theme.AppCompat.Light.DarkActionBar
就是兼容包的。
如果强行改成非兼容包的,就报错了。
怎么做
- 让 MainActivity 为继承自 Activity,而非 AppCompatActivity,并且将 Activity 中所有用到 v7 包的控件都为非 v7 包的。
- 删除默认 Activity 和 布局,重新创建 Activity extends Activity
0 0
- Failed to resolve attribute at index 6
- java.lang.RuntimeException: Failed to resolve attribute at index 6
- 使用TextInputLayout所遇到的坑-java.lang.UnsupportedOperationException: Failed to resolve attribute at index
- UnsupportedOperationException: Failed to resolve attribute xxx系列的问题
- Failed to resolve: 之一
- Failed to resolve:aar
- Android Studio failed to resolve .....
- Android Studio:Failed to resolve
- AndroidStudio提示failed to resolve:
- failed to resolve:com.github.********
- Failed to resolve: com.github
- TNS-03505: Failed to resolve name
- TNS-03505: Failed to resolve name
- gipchaInternalResolve:failed to resolve ret gipcretKeyNotFound(36),
- Failed to resolve: junit:junit:4.12解决方案
- failed to resolve:com.android.support:appcompat
- AS - Failed to resolve: junit:junit:4.12
- Failed to resolve:com.android.support:xxxx
- flask框架配置email问题汇总,包括163邮箱,qq邮箱,gmail等国内外邮箱
- 关于App版本判断 与 AppStore比对
- Codeforces Round #347 (Div. 2) C
- excel 批量数字格式转换成文本格式
- jstl中格式化时间
- Failed to resolve attribute at index 6
- OpenCV安装
- 理解RESTful架构
- zookeeper监听<一>
- 水果布局
- 白话经典算法系列之七 堆与堆排序
- POJ3009 Curling 2.0
- 百科(.NET)(整理)
- cordova6.0.0开发过程中遇到的难题