Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/190.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android CheckedTextView如何获取choiceIndicator默认可绘制名称?_Android_Android View_Android Resources - Fatal编程技术网

Android CheckedTextView如何获取choiceIndicator默认可绘制名称?

Android CheckedTextView如何获取choiceIndicator默认可绘制名称?,android,android-view,android-resources,Android,Android View,Android Resources,有人知道在android.R.attr.listcoi中使用的默认Drawables名称是什么‌​CEINDICATOR多个和android.R.attr.listcoi‌​CEINDICATOR单字符? 我想有计划地在模式之间切换,不使用原始资源 使用这种方式是不可能的: view.setCheckMarkDrawable(android.R.attr.listChoi‌​ceIndicatorMultiple); 因此,我试图找出android.R.attr.listcoi引用的真正的可绘

有人知道在
android.R.attr.listcoi中使用的默认
Drawables
名称是什么‌​CEINDICATOR多个
android.R.attr.listcoi‌​CEINDICATOR单字符?

我想有计划地在模式之间切换,不使用原始资源

使用这种方式是不可能的:

view.setCheckMarkDrawable(android.R.attr.listChoi‌​ceIndicatorMultiple);

因此,我试图找出
android.R.attr.listcoi引用的真正的可绘制的名称‌​CeIndicator Multiple

我在appCompat中找到了以下资源:

   static int checkMaterial = android.support.v7.appcompat.R.drawable.abc_btn_check_material;
   static int radioMaterial = android.support.v7.appcompat.R.drawable.abc_btn_radio_material;
而且效果很好

已编辑

更好的解决方案是:

ViewHolder holder;...

TypedValue value = new TypedValue();
Resources.Theme theme =  holder.textView.getContext().getTheme();
int checkMarkDrawableResId;

if (isMultiSelectionEnabled) {

    theme.resolveAttribute(android.R.attr.listChoiceIndicatorMultiple, value, true);
    int checkMarkDrawableResId = value.resourceId;

} else {

    theme.resolveAttribute(android.R.attr.listChoiceIndicatorSingle, value, true);
    int checkMarkDrawableResId = value.resourceId;
}

holder.textView.setCheckMarkDrawable(checkMarkDrawableResId);

你的意思是谷歌搜索中的“android获取属性值”结果?@Selvin,你知道如何使用运行时属性吗?你已经试过这样做了吗?所以,是的!在提出问题之前,我自己进行了研究,我尝试检查了组件defaultstyleable等等。