AndroidStudio-xml预览布局无法正常显示tag requires a 'drawable' attribute or child tag defining a drawable
来源:互联网 发布:民营经济数据 编辑:程序博客网 时间:2024/05/06 09:40
异常信息:
今天实现RadioButton设置选中时改变背景,准备看下布局预览效果时,发现布局空白,报错为:
<item>tag requires a 'drawable' attribute or child tag defining a drawable
异常原因:
一个RadioButton的背景设置错误
android:background="@drawable/rbtn_main_data_bg_selected"
报错信息的意思翻译过来是说background要设置为drawable类型
于是打开rbtn_main_data_bg_selected发现使用的是@color
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:color="@color/alpha_white"></item> <item android:state_checked="false" android:color="@color/alpha"></item></selector>
异常解决:
改为正确设置如下,刷新一下,然后就能同步看到布局改变了
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 点击状态下的效果 --> <item android:state_checked="true"> <shape> <!-- 设置背景填充色为半透明白色 --> <solid android:color="@color/alpha_white"/> </shape> </item> <!-- 正常状态下(非点击)的效果 --> <item android:state_checked="false"> <shape> <!-- 设置背景填充色为透明色 --> <solid android:color="@color/alpha"/> </shape> </item></selector>
0 1
- AndroidStudio-xml预览布局无法正常显示tag requires a 'drawable' attribute or child tag defining a drawable
- tag requires a 'drawable' attribute or child tag defining a drawable 错误解决
- Binary XML file line #4: <item> tag requires a 'drawable' attribute or child tag defining a drawable
- Binary XML file line #3: <item> tag requires a 'drawable' attribute or child tag defining a drawable
- <item> tag requires a 'drawable' attribute or child tag defining a drawab
- <item> tag requires a 'drawable' attribute or child tag defining a drawab
- <item> tag requires a 'color' attribute or child tag defining a drawable
- android背景设置报错 <item> tag requires a 'drawable' attribute or child tag defining a drawable
- android背景设置报错 <item> tag requires a 'drawable' attribute or child tag defining a drawable<转>
- android背景设置报错 <item> tag requires a 'drawable' attribute or child tag defining a drawable
- android背景设置报错 <item> tag requires a 'drawable' attribute or child tag defining a drawable
- android背景设置报错 <item> tag requires a 'drawable' attribute or child tag defining a drawable
- textcolor 设置selecter 报错: <item> tag requires a 'color' attribute or child tag defining a drawab
- "<item> tag requires a 'drawable' attribute"-selector设置颜色不成功-解决方案
- "<item> tag requires a 'drawable' attribute"-selector设置颜色不成功-解决方案
- "<item> tag requires a 'drawable' attribute"-selector设置颜色不成功-解决方案
- <item> tag requires a 'drawable' attribute"-selector设置颜色报错-原因及解决方案
- <item> tag requires a 'drawable' attribute"-selector设置颜色不成功-解决方案
- 线程的生命周期与常用方法
- 做项目时一个listview 里面嵌套ediTtext 滑动之后 保存数据
- Android studio版本控制之svn,git,github配置。
- easyui combobox默认选中第一个
- springmvc 自定义异常页面
- AndroidStudio-xml预览布局无法正常显示tag requires a 'drawable' attribute or child tag defining a drawable
- ccah-500 第37题 You want to clean up this list by removing jobs where the State is KILLED
- 【iOS开发】NSDictionary 判空处理
- Pull解析
- MySQL INSERT插入条件判断:如果不存在则插入
- Android中Selector的用法
- 2016.06.15廖雪峰JS__学习笔记(原型对象)__P8
- 面试题29 数组中超过一半的数字
- HTML5学习之路(2)