implementation 'me.luzhuo.java.android:lib_core:1.0.83-SNAPSHOT'
<me.luzhuo.lib_core.ui.widget.tagbutton.TagButtonView
android:id="@+id/tag_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:core_interval="8dp"
app:core_single="true"
app:core_span_count="4" />
TagButtonView tagButtonView = findViewById(R.id.tag_button);
tagButtonView.setTagButtonListener(new TagButtonListener() {
@Override
public void onSelect(int position, TagButton data) {
ToastManager.show(MainActivity.this, data.title);
}
});
final List<TagButton> datas = new ArrayList<>();
for (int i = 0; i < 10; i++) {
if (i == 1) datas.add(new TagButton("选项" + i, null));
if (i == 2) datas.add(new TagButton("选项" + i, null, true, true));
if (i == 3) datas.add(new TagButton("选项" + i, null, true, false));
datas.add(new TagButton("选项" + i, null));
}
tagButtonView.setDatas(datas);