---
title: "NotFoundException  android.R.attr.listChoiceIndicatorMultiple解决方案"
author: "Darar"
date: "2012-05-02T18:10:38Z"
tags: []
categories: ["移动开发"]
slug: "notfoundexception-android-r-attr-listchoiceindicatormultiple"
draft: false
lastmod: "2012-05-02T18:10:38Z"
id: 1507883
url: "https://darar.iteye.com/blog/1507883"
---

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

 

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