Android 标签群组 TagGroup

码农软件 · 软件分类 · Android UI 组件 · 2019-04-25 19:29:28

软件介绍

TagGroup 是标签群组,支持文字和程序内部图片。

1、TagGroup属性介绍

<com.xiaofan.taggroup.TagGroup
        android:id="@+id/tagGroup"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#f08070"
        app:tagBackgroundColor="#ffffff"
        app:tagCornerRadius="6dp"
        app:tagHorizontalPadding="8dp"
        app:tagHorizontalSpace="8dp"
        app:tagStrokeColor="#000000"
        app:tagTextColor="#000000"
        app:tagTextSize="16sp"
        app:tagVerticalPadding="4dp"
        app:tagVerticalSpace="8dp" />

tagBackgroundColor:标签背景色;
tagCornerRadius:标签圆角半径;
tagHorizontalPadding:标签水平方向内边距;
tagHorizontalSpace:标签之间的水平间距;
tagStrokeColor:标签的描边颜色;
tagTextColor:标签文字颜色;
tagTextSize:标签文字大小;
tagVerticalPadding:标签竖直方向内边距;
tagVerticalSpace:标签之间的竖直边距。

2、添加标签

ArrayList<Tag> tags = new ArrayList<>();
        for (int i = 0; i < 7; i++) {
            Tag tag = new Tag();
            tag.setType(Tag.TYPE_TEXT);
            tag.setTagText("tag" + i);
            tags.add(tag);
        }

        Tag tag = new Tag();
        tag.setType(Tag.TYPE_ICON);
        tag.setIconID(R.drawable.icon_apple);
        tags.add(tag);

        tag = new Tag();
        tag.setType(Tag.TYPE_ICON);
        tag.setIconID(R.drawable.icon_banana);
        tags.add(tag);

        tag = new Tag();
        tag.setType(Tag.TYPE_ICON);
        tag.setIconID(R.drawable.icon_pear);
        tags.add(tag);

        tag = new Tag();
        tag.setType(Tag.TYPE_ICON);
        tag.setIconID(R.drawable.icon_more);
        tags.add(tag);

        tagGroup.setTags(tags);

3、绑定标签点击事件监听器

需要实现TagGroup的OnTagClickListener接口,然后调用setOnTagClickListener设置监听器即可。

本文地址:https://codercto.com/soft/d/4378.html

精通Spring 4.x

精通Spring 4.x

陈雄华、林开雄、文建国 / 电子工业出版社 / 2017-1-1 / CNY 128.00

Spring 4.0是Spring在积蓄4年后,隆重推出的一个重大升级版本,进一步加强了Spring作为Java领域第一开源平台的翘楚地位。Spring 4.0引入了众多Java开发者翘首以盼的基于Groovy Bean的配置、HTML 5/WebSocket支持等新功能,全面支持Java 8.0,最低要求是Java 6.0。这些新功能实用性强、易用性高,可大幅降低Java应用,特别是Java W......一起来看看 《精通Spring 4.x》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

随机密码生成器
随机密码生成器

多种字符组合密码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具