1. implementation 'me.luzhuo.java.android:lib_core:1.0.83-SNAPSHOT'

    TagButton.jpg

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