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

开发时需要动态添加 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();
 

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

你可能感兴趣的:(exception)