whilu / AndroidTagView

A TagView library for Android. Customize your own & Drag effect.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can i change the icon for remove? Could't not find it!

JaydipRadadiya opened this issue · comments

Hello,
Is there any way to change the remove icon instead of 'X' to another drawable icons ?

commented

Sorry, this feature is not support now. But you can use below attributes to draw your own 'X' icon:

  • tag_cross_width
  • tag_cross_color
  • tag_cross_line_width
  • tag_cross_area_padding

Maybe I will support custom drawable in the feature, thanks 😄

Hi whilu!

Thank you for the quick response. Appreciate for the support custom drawable feature.

May i know how can i set TAG view background programmatically as a png image, so that we can resolve the issue.

commented

Hi, JaydipRadadiya!

Try use tag_background attribute, maybe this will help you.

Thanks!

Hi @whilu

Just a follow up. Have you added the support for changing the cross icon. Actually i need to add a plus icon instead of cross icon and then define some functionality.
Any work around for this issue?

Hi @manish-poddar

I have a set + icon instead of cross for that you need to make a png (according to your UI) and set as backroung like as :
tagLayout.getTagView(i).setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_tag_add));

Thanks.

Hi @JaydipRadadiya

It's not working for me. It is still showing cross sign.
@whilu Any support will be appreciated.

Hi @manish-poddar

Have a look like this, I have used as

tagLayout.getTagView(i).setEnableCross(true);
                tagLayout.getTagView(i).setCrossColor(getResources().getColor(R.color.transparent));
                tagLayout.getTagView(i).setTagTextColor(getResources().getColor(R.color.red));
                tagLayout.getTagView(i).setBorderWidth(1);
                tagLayout.getTagView(i).setTagBorderColor(getResources().getColor(R.color.red));
                tagLayout.getTagView(i).setTagBackgroundColor(getResources().getColor(R.color.transparent));
                tagLayout.getTagView(i).setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_tag_add));

Handle Click event as well like this :

tagLayout.setOnTagClickListener(new TagView.OnTagClickListener() {

            @Override
            public void onTagClick(int position, String text) {

                if (text.equalsIgnoreCase(getResources().getString(R.string.Add_Tag))) {//Default
                    startActivityForResult(new Intent(getActivity(), ViewRaceListActivity.class).putStringArrayListExtra("RACE_SELECTED_LIST", raceSelectedList), CV.INTENT100);
                } else {
                    CM.print(".... onTagClick : " + text + " position : " + position);
                }

            }

            @Override
            public void onTagLongClick(int position, String text) {

            }

            @Override
            public void onTagCrossClick(int position) {
                CM.print(".... #onTagCrossClick : " + " position : " + position + " Name : " + tagLayout.getTagText(position));

                if (tagLayout.getTagText(position).equalsIgnoreCase(getResources().getString(R.string.Add_Tag))) {//Default
                    CM.print("........Default : Add");
                    startActivityForResult(new Intent(getActivity(), ViewRaceListActivity.class), CV.INTENT100);
                } else {

                    tagLayout.removeTag(position);
                    if (raceSelectedList.size() > 0)
                        raceSelectedList.remove(position);

                    CM.print("______ raceSelectedList : Size : " + raceSelectedList.size());
                }

            }

        });