当前位置:网站首页>直播软件搭建,流式布局,支持单选、多选等
直播软件搭建,流式布局,支持单选、多选等
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();*/
}
}
以上就是 直播软件搭建,流式布局,支持单选、多选等,更多内容欢迎关注之后的文章
边栏推荐
- 【愚公系列】2022年08月 Go教学课程 035-接口和继承和转换与空接口
- FTP错误代码列表
- The solution to the height collapse problem
- 机器学习中什么是集成学习?
- "104 Maximum Depth of Binary Trees" in LeetCode's Day 12 Binary Tree Series
- Enter the starting position, the ending position intercepts the linked list
- 华南师范宋宇老师课堂对话论文翻译
- What should I do if the channel ServerID is incorrect when EasyCVR is connected to a Hikvision Dahua device and selects another cluster server?
- js 将字符串作为js执行代码使用
- LeetCode刷题第16天之《239滑动窗口最大值》
猜你喜欢

es-head插件插入查询以及条件查询(五)

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

Build Zabbix Kubernetes cluster monitoring platform

电力机柜数据监测RTU

"104 Maximum Depth of Binary Trees" in LeetCode's Day 12 Binary Tree Series

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

Echart地图的省级,以及所有地市级下载与使用

Multi-merchant mall system function disassembly 26 lectures - platform-side distribution settings

DNS separation resolution and intelligent resolution

Where can machine learning be applied?What is machine learning useful for?
随机推荐
MySQL数据库存储引擎以及数据库的创建、修改与删除
[C Language] Getting Started
The development of the massage chair control panel makes the massage chair simple and intelligent
STC8H development (15): GPIO drive Ci24R1 wireless module
Common layout effect realization scheme
用户如何克服程序化交易中的情绪问题?
【FPGA】SDRAM
Uni - app - access to Chinese characters, pinyin initials (according to the Chinese get pinyin initials)
Will oracle cardinality affect query speed?
uni-app - 城市选择索引列表 / 通过 A-Z 排序的城市列表(uview 组件库 IndexList 索引列表)
机器学习是什么?详解机器学习概念
程序化交易改变了什么?
Docker 链接sqlserver时出现en-us is an invalid culture错误解决方案
Is there any way for kingbaseES to not read the system view under sys_catalog by default?
电力机柜数据监测RTU
LeetCode刷题第17天之《3 无重复字符的最长子串》
【愚公系列】2022年08月 Go教学课程 035-接口和继承和转换与空接口
What should I do if the channel ServerID is incorrect when EasyCVR is connected to a Hikvision Dahua device and selects another cluster server?
What kind of programming trading strategy types can be divided into?
Alibaba Cloud releases 3 high-performance computing solutions