flow的简单适配器

class  KeyAdpter extends TagAdapter<String>{
    public KeyAdpter(List<String> datas) {
        super(datas);
    }

    @Override
    public View getView(FlowLayout parent, int position, String s) {
        TextView textView = new TextView(parent.getContext());
        textView.setText(s);
        textView.setTextSize(15);
        return  textView;
    }
}
List<String> strings = new ArrayList<>();
strings.add("电动牙刷");
strings.add("豆豆鞋");
strings.add("沐浴露");
strings.add("榴莲");
strings.add("尤妮佳");
strings.add("雅诗兰黛");
strings.add("日东红茶");
strings.add("呵呵");
KeyAdpter adpter = new KeyAdpter(strings);
flowLayout.setAdapter(adpter);

猜你喜欢

转载自blog.csdn.net/qq_41880248/article/details/81489051
今日推荐