New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query : How to change background color or set background drawable to a specific TAG for onClick event #54
Comments
@pravingaikwad123 mTagcontainerLayout.setOnTagClickListener(new TagView.OnTagClickListener() {
@Override
public void onTagClick(int position, String text) {
TagView tagView = mTagcontainerLayout.getTagView(position);
tagView.setTagTextColor(Color.GRAY);
tagView.setTagBackgroundColor(Color.YELLOW);
tagView.setTagBorderColor(Color.BLACK);
tagView.postInvalidate();
}
@Override
public void onTagLongClick(int position, String text) {}
@Override
public void onTagCrossClick(int position) {}
}); |
Thanks alot. It worked. |
@whilu : Please suggest me a way to set default background drawable to all the tags in the tagcontainer. Can I do this within xml itself ? What is the attribute for it ? Or do I need to use "for" loopand getAllTagViews from container and then set background (drawable) to each view... I want to do something like this : My present code resultant --> |
@pravingaikwad123 for (int i = 0; i < mTagContainerLayout.getTags().size(); ++i){
TagView tagView = mTagContainerLayout.getTagView(i);
tagView.setBackgroundResource(R.drawable.xxx);
tagView.postInvalidate();
} |
@whilu .. Thanks for the answer. Can yougive me a rough idea uptil when you'll release updated version ? So, that I can keep my work on hold accordingly. |
That's easy!
1. Add an attribute
2. Read attribute value from xml
3. Set this attribute value
2017-05-31 23:38 GMT+08:00 pravingaikwad123 <notifications@github.com>:
… @whilu <https://github.com/whilu> .. Thanks for the answer.
Can yougive me a rough idea uptil when you'll release updated version ?
So, that I can keep my work on hold accordingly.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#54 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGkeW7wpKlYwlM-DaW-6KtRNaL6IpN9Aks5r_YljgaJpZM4Np5SY>
.
|
@pravingaikwad123 The latest version How to set(two ways):
mTagContainerLayout.setTagBackgroundResource(R.drawable.xxx); |
I want to set different drawable/color to a specific tag on onClick on that tag. Pls suggest me the way to do so.
Below is my code:
xml:
Code:
The text was updated successfully, but these errors were encountered: