ListView控件与固定数量的项目,以显示 [英] ListView with the fixed number of items to display

查看:176
本文介绍了ListView控件与固定数量的项目,以显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在Android中创建覆盖由width内容的列表视图中的任何标准方式,但随着高度行显示一个固定数量够大吗?

is there any standard way in Android for creating a list view covering content by width, but with the height big enough for displaying a fixed number of rows?

例如,我希望我的ListView滚动在屏幕/活动的一次显示刚好6个项目从20中间流行起来。

For example, I would want my scrollable listview to pop up in the middle of a screen/activity displaying exactly 6 items out of 20 at a time.

推荐答案

解决方案WRAP_CONTENT的ListView的宽度工作(见getWidestView)。同样的事情可以应用于高(使用假的父母和* 6后测量的高度)

The solution from wrap_content for a listview's width works ( see getWidestView ). Same thing can be applied for height ( measure a height using fake parent and *6 after )

这篇关于ListView控件与固定数量的项目,以显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆