当前位置:网站首页>直播软件搭建,流式布局,支持单选、多选等
直播软件搭建,流式布局,支持单选、多选等
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();*/
}
}
以上就是 直播软件搭建,流式布局,支持单选、多选等,更多内容欢迎关注之后的文章
边栏推荐
- What is ensemble learning in machine learning?
- Multi-merchant mall system function disassembly 26 lectures - platform-side distribution settings
- Interchangeability and Measurement Technology—Surface Roughness Selection and Marking Method
- Will oracle cardinality affect query speed?
- 机器学习怎么学?机器学习流程
- 【FPGA】day20-I2C读写EEPROM
- Leetcode 450. 删除二叉搜索树中的节点
- 高校就业管理系统设计与实现
- 【Yugong Series】August 2022 Go Teaching Course 036-Type Assertion
- 一文读懂 高性能可预期数据中心网络
猜你喜欢
[FPGA] day19- binary to decimal (BCD code)
QueryDet: Cascading Sparse Query Accelerates Small Object Detection at High Resolution
What is machine learning?Explain machine learning concepts in detail
Differences and connections between distributed and clustered
【组成原理 九 CPU】
【FPGA】SDRAM
The custom of the C language types -- -- -- -- -- - structure
"3 Longest Substring Without Repeating Characters" on the 17th day of LeetCode brushing
What should I do if the channel ServerID is incorrect when EasyCVR is connected to a Hikvision Dahua device and selects another cluster server?
[FPGA] Design Ideas - I2C Protocol
随机推荐
Description of ESB product development steps under cloud platform
拼多多店铺营业执照相关问题
Graphical LeetCode - 640. Solving Equations (Difficulty: Moderate)
Qnet弱网测试工具操作指南
A brief analysis of whether programmatic futures trading or manual order is better?
Day20 FPGA 】 【 - block the I2C read and write EEPROM
【愚公系列】2022年08月 Go教学课程 036-类型断言
STC8H开发(十五): GPIO驱动Ci24R1无线模块
【FPGA】SDRAM
移动端地图开发选择哪家?
C语言 recv()函数、recvfrom()函数、recvmsg()函数
shell监视gpu使用情况
什么是机器强化学习?原理是什么?
浅析一下期货程序化交易好还是手工单好?
【FPGA】day21-移动平均滤波器
DNS separation resolution and intelligent resolution
What problems should we pay attention to when building a programmatic trading system?
阿里云发布3大高性能计算解决方案
LeetCode刷题第10天字符串系列之《125回文串验证》
UNI-APP_iphone bottom safe area