AndroidTagView icon indicating copy to clipboard operation
AndroidTagView copied to clipboard

How to set highlighted of Selected tag Theme

Open ywqyunshan opened this issue 9 years ago • 3 comments

ywqyunshan avatar Sep 23 '16 01:09 ywqyunshan

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 avatar Sep 23 '16 13:09 whilu

@whilu any update on this ? i also want to change background color of selected tag....

engr-erum avatar Sep 28 '17 08:09 engr-erum

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();
        }
    }

arulpandianrasu avatar Oct 30 '18 13:10 arulpandianrasu