ITeye博客

NotFoundException android.R.attr.listChoiceIndicatorMultiple解决方案

Darar · 2012-05-02 18:10 · android技术文章 · 移动开发 · Markdown

开发时需要动态添加 CheckedTextView ,而我们需要在代码中设置,setCheckMarkDrawable它的选择框图片。

通常我们直接用系统 的setCheckMarkDrawable (android.R.attr.listChoiceIndicatorMultiple)。

可是会报找不到资源的错误。

 

从google上找到解 决方法

//根据数组id得到数组类型 
int[] attrs = { android.R.attr.listChoiceIndicatorMultiple };
TypedArray ta = mContext.getTheme().obtainStyledAttributes(attrs);		Drawable indicator = ta.getDrawable(0);		ctv.setCheckMarkDrawable(indicator);
ta.recycle();

 

至于原因不知道 为什么会报这种错误

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。