如何获取编辑文本中的选定项目并在十字符号的矩形框中显示项目
问题描述:
我正在开发一个消息应用程序,因此为此我想在Edit-Text中显示所选联系人下面的图像。请参阅下图中上方的编辑文本显示带有十字符号的小矩形框内的联系人名称以将其删除。如何获取编辑文本中的选定项目并在十字符号的矩形框中显示项目
我该如何设计,任何建议或窍门都会有所帮助。
答
嘿,这是通过使用谷歌的FlexBoxLayout最近被谷歌的Android平台推出的可能。
https://github.com/google/flexbox-layout
步骤做:
1)中添加的gradle Flexbox的依赖。
dependencies {
compile 'com.google.android:flexbox:0.3.1'
}
2)采取recyclerview和设计它的项目,因为你想显示和制作一个回收适配器。
3)使用FlexboxLayoutManager设置recyclerview的layoutmanager。
RecyclerView recyclerView = (RecyclerView)context.findViewById(R.id.recyclerview);
FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(context);
recyclerview.setLayoutManager(layoutmanager);
recyclerView.setAdapter(demoAdapter);
然后你很好去。 :)快乐编码...
+0
谢谢领导Mr.SK – user8515823
到目前为止你做了什么? –