当前位置:网站首页>橫向滾動的RecycleView一屏顯示五個半,低於五個平均分布
橫向滾動的RecycleView一屏顯示五個半,低於五個平均分布
2022-07-05 10:11: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);
}
边栏推荐
- How to get the STW (pause) time of GC (garbage collector)?
- QT VT100 parser
- Cent7 Oracle database installation error
- 【C语言】动态内存开辟的使用『malloc』
- 程序员搞开源,读什么书最合适?
- Comment obtenir le temps STW du GC (collecteur d'ordures)?
- CSDN always jumps to other positions when editing articles_ CSDN sends articles without moving the mouse
- QT event filter simple case
- Fluent generates icon prompt logo widget
- [system design] index monitoring and alarm system
猜你喜欢
How Windows bat script automatically executes sqlcipher command
Wechat applet - simple diet recommendation (2)
How to use sqlcipher tool to decrypt encrypted database under Windows system
Observation cloud and tdengine have reached in-depth cooperation to optimize the cloud experience of enterprises
90%的人都不懂的泛型,泛型的缺陷和应用场景
How to get the STW (pause) time of GC (garbage collector)?
. Net delay queue
Wechat applet - simple diet recommendation (3)
Hard core, have you ever seen robots play "escape from the secret room"? (code attached)
历史上的今天:第一本电子书问世;磁条卡的发明者出生;掌上电脑先驱诞生...
随机推荐
Comment obtenir le temps STW du GC (collecteur d'ordures)?
Mysql80 service does not start
Wechat applet - simple diet recommendation (4)
Jupiter notebook shortcut key
Flutter development: a way to solve the problem of blank space on the top of listview
Implementation of smart home project
Are databases more popular as they get older?
Matrix processing practice
Tdengine can read and write through dataX, a data synchronization tool
Roll up, break 35 - year - old Anxiety, animation Demonstration CPU recording Function call Process
ThreadLocal source code learning
@JsonAdapter注解使用
美图炒币半年亏了3个亿,华为被曝在俄罗斯扩招,AlphaGo的同类又刷爆一种棋,今日更多大新闻在此...
如何获取GC(垃圾回收器)的STW(暂停)时间?
[NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution
Common fault analysis and Countermeasures of using MySQL in go language
钉钉、企微、飞书学会赚钱了吗?
Android SQLite database encryption
How to correctly evaluate video image quality
Coffeescript Chinese character to pinyin code