当前位置:网站首页>横向滚动的RecycleView一屏显示五个半,低于五个平均分布
横向滚动的RecycleView一屏显示五个半,低于五个平均分布
2022-07-05 09:41: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);
}
边栏推荐
- [technical live broadcast] how to rewrite tdengine code from 0 to 1 with vscode
- Matrix processing practice
- 单片机原理与接口技术(ESP8266/ESP32)机器人类草稿
- Apache dolphin scheduler system architecture design
- Energy momentum: how to achieve carbon neutralization in the power industry?
- 钉钉、企微、飞书学会赚钱了吗?
- Baidu app's continuous integration practice based on pipeline as code
- 基于单片机步进电机控制器设计(正转反转指示灯挡位)
- 一个程序员的职业生涯到底该怎么规划?
- Small program startup performance optimization practice
猜你喜欢
Cent7 Oracle database installation error
Apache DolphinScheduler 系统架构设计
[C language] the use of dynamic memory development "malloc"
90%的人都不懂的泛型,泛型的缺陷和应用场景
Design and Simulation of fuzzy PID control system for liquid level of double tank (matlab/simulink)
Comment obtenir le temps STW du GC (collecteur d'ordures)?
Kotlin Compose 多个条目滚动
Evolution of Baidu intelligent applet patrol scheduling scheme
《微信小程序-基础篇》小程序中的事件与冒泡
Kotlin Compose 与原生 嵌套使用
随机推荐
[NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution
Tdengine offline upgrade process
[NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution
How to use sqlcipher tool to decrypt encrypted database under Windows system
面试:List 如何根据对象的属性去重?
高级 OpenCV:BGR 像素强度图
美图炒币半年亏了3个亿,华为被曝在俄罗斯扩招,AlphaGo的同类又刷爆一种棋,今日更多大新闻在此...
@SerializedName注解使用
Application of data modeling based on wide table
Windows uses commands to run kotlin
MySQL字符类型学习笔记
[system design] index monitoring and alarm system
ArcGIS Pro 创建要素
How to implement complex SQL such as distributed database sub query and join?
[C language] the use of dynamic memory development "malloc"
H. 265 introduction to coding principles
Wechat applet - simple diet recommendation (3)
剪掉ImageNet 20%数据量,模型性能不下降!Meta斯坦福等提出新方法,用知识蒸馏给数据集瘦身...
Data visualization platform based on template configuration
oracle和mysql批量Merge对比