📜  如何动态添加芯片 android - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:15.605000             🧑  作者: Mango

代码示例1
ChipGroup chipGroup = new ChipGroup(parentView.getContext());

String[] genres = {"Thriller", "Comedy", "Adventure"};
for(String genre : genres) {
 Chip chip = new Chip(parentView.getContext());
 chip.setText(genre);
 chipGroup.addView(chip);
}