当前位置:网站首页>直播软件搭建,流式布局,支持单选、多选等
直播软件搭建,流式布局,支持单选、多选等
2022-08-11 03:58:00 【云豹网络科技】
直播软件搭建,流式布局,支持单选、多选等
用法:
dependencies {
compile 'com.hyman:flowlayout-lib:1.1.2'
}
布局:
<!--max_select:-1为不限制选择数量,>=1的数字为控制选择tag的数量-->
<com.zhy.view.flowlayout.TagFlowLayout
android:id="@+id/id_flowlayout"
zhy:max_select="-1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp">
</com.zhy.view.flowlayout.TagFlowLayout>
代码:
public class FlowlayoutActivity extends AppCompatActivity {
TagFlowLayout tagFlowLayout;
private List<String> list;
private LayoutInflater layoutInflater;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.flowlayout_activity);
private void initView(){
layoutInflater = LayoutInflater.from(this);
tagFlowLayout = findViewById(R.id.id_flowlayout);
tagFlowLayout.setAdapter(new TagAdapter<String>(list)
{
@Override
public View getView(FlowLayout parent, int position, String s)
{
TextView tv = (TextView) layoutInflater.inflate(R.layout.flowlayout_item_tv,
tagFlowLayout, false);
tv.setText(s);
return tv;
}
});
tagFlowLayout.setOnTagClickListener(new TagFlowLayout.OnTagClickListener()
{
@Override
public boolean onTagClick(View view, int position, FlowLayout parent)
{
//得到点击的值
Toast.makeText(getApplicationContext(), list.get(position), Toast.LENGTH_SHORT).show();
return true;
}
});
tagFlowLayout.setOnSelectListener(new TagFlowLayout.OnSelectListener() {
@Override
public void onSelected(Set<Integer> selectPosSet) {
Log.i("得到下标的集合",selectPosSet.toString());
//得到下标的集合
//Toast.makeText(getApplicationContext(), selectPosSet.toString()+"s", Toast.LENGTH_SHORT).show();
}
});
/*//预先设置选中 mAdapter.setSelectedList(1,3,5,7,8,9); //获得所有选中的pos集合 flowLayout.getSelectedList();*/
}
}
以上就是 直播软件搭建,流式布局,支持单选、多选等,更多内容欢迎关注之后的文章
边栏推荐
- 荣威imax8ev魔方电池安全感,背后隐藏着哪些黑化膨胀?
- LeetCode刷题第17天之《3 无重复字符的最长子串》
- 【FPGA】day20-I2C读写EEPROM
- 【力扣】22.括号生成
- 【FPGA】SDRAM
- App Basic Framework Construction丨Log Management - KLog
- EasyCVR接入GB28181设备时,设备接入正常但视频无法播放是什么原因?
- I didn't expect MySQL to ask these...
- 机器学习怎么学?机器学习流程
- How to learn machine learning?machine learning process
猜你喜欢

2022-08-10 The sixth group Hiding spring study notes

es-head plugin insert query and conditional query (5)

LeetCode刷题第11天字符串系列之《 58最后一个单词长度》

Read the article, high-performance and predictable data center network

Build Zabbix Kubernetes cluster monitoring platform

A large horse carries 2 stone of grain, a middle horse carries 1 stone of grain, and two ponies carry one stone of grain. It takes 100 horses to carry 100 stone of grain. How to distribute it?

【FPGA】day20-I2C读写EEPROM
![[C Language] Getting Started](/img/5e/484e3d426a6f1cc0d792a9ba330695.png)
[C Language] Getting Started
![[yu gong series] Go program 035-08 2022 interfaces and inheritance and transformation and empty interface](/img/cb/41e5f553b0b776dccf0e39f9bf377f.png)
[yu gong series] Go program 035-08 2022 interfaces and inheritance and transformation and empty interface

Is Redis old?Performance comparison between Redis and Dragonfly
随机推荐
【组成原理 九 CPU】
uni-app - 获取汉字拼音首字母(根据中文获取拼音首字母)
"98 BST and Its Verification" of the 13th day of leetcode brushing series of binary tree series
Getting Started with Raspberry Pi (5) System Backup
EasyCVR接入GB28181设备时,设备接入正常但视频无法播放是什么原因?
A simple JVM tuning, learn to write it on your resume
The last update time of the tables queried by the two nodes of the rac standby database is inconsistent
这些云自动化测试工具值得拥有
Pinduoduo store business license related issues
【FPGA】day22-SPI protocol loopback
Homework 8.10 TFTP protocol download function
LeetCode刷题第11天字符串系列之《 58最后一个单词长度》
Callable实现多线程
C语言 recv()函数、recvfrom()函数、recvmsg()函数
The "top pillar" slides, and new growth is extremely difficult to shoulder the heavy responsibility. Is Ali "squatting" to jump higher?
【C语言】入门
Common layout effect realization scheme
STC8H开发(十五): GPIO驱动Ci24R1无线模块
Rotary array problem: how to realize the array "overall reverse, internal orderly"?"Three-step conversion method" wonderful array
"3 Longest Substring Without Repeating Characters" on the 17th day of LeetCode brushing