AndroidTagView
AndroidTagView copied to clipboard
How to set highlighted of Selected tag Theme
Sorry, this feature is now not support! I will add this as soon as possible!
Thanks.
2016-09-23 9:42 GMT+08:00 IIGEOywq [email protected]:
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/whilu/AndroidTagView/issues/29, or mute the thread https://github.com/notifications/unsubscribe-auth/AGkeW11FkGWyClsPq1hO053nj2rH52ARks5qsy6JgaJpZM4KEh3Y .
@whilu any update on this ? i also want to change background color of selected tag....
Just Try
private void setTagClickListener() {
tagContainerLayout.setOnTagClickListener(new TagView.OnTagClickListener() {
@Override
public void onTagClick(int position, String text) {
setTagSelectedColor(position);
}
@Override
public void onTagLongClick(final int position, String text) {
}
@Override
public void onTagCrossClick(int position) {
}
});
}
private void setTagSelectedColor(int position) {
for (int i = 0; i < tagStringList.size(); i++) {
TagView tag = tagContainerLayout.getTagView(i);
if (i == position) {
tag.setTagBackgroundColor(getResources().getColor(R.color.colorPrimary));
tag.setTagTextColor(getResources().getColor(R.color.textColorWhite));
} else {
tag.setTagBackgroundColor(getResources().getColor(R.color.textColorWhite));
tag.setTagTextColor(getResources().getColor(R.color.textColorBack));
}
tag.invalidate();
}
}