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

Fortran 95/2003程序设计

Fortran 95/2003程序设计

中国电力出版社 / 2009-8 / 88.00元

Fortran是计算世界最早出现的高级程序设计语言之一,随着面向对象编程时代的到来,Fortran语言不仅保持了发展的步伐,而且继续在科学计算方面领先。《Fortran95/2003程序设计(第3版)》在第2~7章介绍了Fortan语言基础知识,为初学者提供入门学习资料;在第8~15章介绍了Fortran语言高级特性,为深入用好Fortran语言提供支持;在第16章讲述了Fortran语言面向对象......一起来看看 《Fortran 95/2003程序设计》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具