public class LiushiActivity extends AppCompatActivity {
@BindView(R.id.edit_title)
EditText editTitle;
@BindView(R.id.btn_ss)
Button btnSs;
@BindView(R.id.contine)
TagCloudLayout contine;
private ArrayList<String> list;
private TagBaseAdapter tagBaseAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_liushi);
ButterKnife.bind(this);
Intent intent = getIntent();
list = new ArrayList<>();
list.add("黄焖鸡");
list.add("麻辣烫");
list.add("盖饭");
list.add("披萨");
list.add("鸡丁饭");
list.add("米线");
tagBaseAdapter = new TagBaseAdapter(this, list);
btnSs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String s = editTitle.getText().toString();
list.add(s);
tagBaseAdapter.notifyDataSetChanged();
}
});
contine.setAdapter(tagBaseAdapter);
}
}
2扫描二维码
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
new IntentIntegrator(getActivity()).initiateScan();