Issue
Someone knows what is the name default Drawables using in android.R.attr.listChoiceIndicatorMultiple and android.R.attr.listChoiceIndicatorSingle?
I would like programatically switch between modes unsing original resouces drawable.
is not possible using this way:
view.setCheckMarkDrawable(android.R.attr.listChoiceIndicatorMultiple);
So i'm trying to figure out the real drawable name referenced by android.R.attr.listChoiceIndicatorMultiple
Solution
I've found inside appCompat the following resources:
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;
And it works fine!
Edited
The better solution:
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);
Answered By - Anderson K
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.