当前位置:网站首页>横向滚动的RecycleView一屏显示五个半,低于五个平均分布
横向滚动的RecycleView一屏显示五个半,低于五个平均分布
2022-06-28 00:57:00 【沙漠一只雕得儿得儿】
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = mInflater.inflate(R.layout.layout_item_hq_cn_icon, parent, false);
int columnWidth;
if (mDataSet.size() > 5) {
columnWidth = (int) (parent.getMeasuredWidth() / 5.57f);
} else {
columnWidth = (int) (parent.getMeasuredWidth() / mDataSet.size());
}
RecyclerView.LayoutParams lp = new RecyclerView.LayoutParams(columnWidth, RecyclerView.LayoutParams.WRAP_CONTENT);
itemView.setLayoutParams(lp);
return ViewHolder.createViewHolder(mContext, itemView);
}边栏推荐
- 贪吃蛇 C语言
- MySQL optimization tips
- 第三批入围企业公示!年度TOP100智能网联供应商评选
- [today in history] May 29: the pioneer of sharing software was born; Chromebox launched; VoodooPC founder was born
- Dynamic Host Configuration Protocol
- File transfer protocol --ftp
- Shardingsphere-proxy-5.0.0 establish MySQL read / write separation connection (6)
- Opencv——霍夫变换以及遇到的一些问题
- Mysql database foundation: DML data operation language
- 一种低成本增长私域流量,且维护简单的方法
猜你喜欢
随机推荐
Data governance and data standards
数智学习|湖仓一体实践与探索
【电梯控制系统】基于VHDL语言和状态机实现的电梯控制系统的设计,使用了状态机
Explanation of OSI layer 7 model (easy to understand in Chinese)
What if win11 can't drag an image to the taskbar software to open it quickly
【历史上的今天】6 月 16 日:甲骨文成立;微软 MSX 诞生;快速傅里叶变换发明者出生
Flashtext, a data cleaning tool, has directly increased the efficiency by dozens of times
Win11不能拖拽圖片到任務欄軟件上快速打開怎麼辦
架构高可靠性应用知识图谱 ----- 架构演进之路
如何开启多语言文本建议?Win11打开多语言文本建议的方法
畢業總結
【历史上的今天】6 月 3 日:微软推出必应搜索引擎;Larry Roberts 启动阿帕网;Visual Basic 之父出生
MFC常用 当前路径
11 timers for STM32F103
【历史上的今天】6 月 12 日:美国进入数字化电视时代;Mozilla 的最初开发者出生;3Com 和美国机器人公司合并
Cvpr22 collected papers | hierarchical residual multi granularity classification network based on label relation tree
架构高可靠性应用知识图谱 ----- 微服务架构图谱
【历史上的今天】6 月 2 日:苹果推出了 Swift 编程语言;电信收购联通 C 网;OS X Yosemite 发布
NER中BiLSTM-CRF解读Forward_algorithm
Win11如何关闭最近打开项目?Win11关闭最近打开项目的方法








