list view item高度设置
2014-07-28 15:17
369 查看
如何设置list view中的item的高度呢?
示例如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/buy_list_item_height" > //直接在这里设置高度是不会生效的。
<!—- 具体的item 内容 —>
</RelativeLayout>
按照如下修改:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/buy_list_item_height" // 再增加一层即可设置高度
android:layout_gravity="center_horizontal" >
<!—-具体的 item内容 —>
</RelativeLayout>
</RelativeLayout>
另外,如何避免 list view adapter反复getivew?
list view在layout种设置时width/height 为match_parent. 或者为指定的大小。 如果使用wrap_content的话,就很又可能导致反复get view.
示例如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/buy_list_item_height" > //直接在这里设置高度是不会生效的。
<!—- 具体的item 内容 —>
</RelativeLayout>
按照如下修改:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/buy_list_item_height" // 再增加一层即可设置高度
android:layout_gravity="center_horizontal" >
<!—-具体的 item内容 —>
</RelativeLayout>
</RelativeLayout>
另外,如何避免 list view adapter反复getivew?
list view在layout种设置时width/height 为match_parent. 或者为指定的大小。 如果使用wrap_content的话,就很又可能导致反复get view.
相关文章推荐
- 设置listitem中每个item的高度
- Android 动态测量list view item的高度
- android关于设置list_item高度问题
- <GridVew 高度自适应>设置GirdView中item高度来填满 达到自适应
- Android girdView/listView item 高度设置无效的解决方法
- RecyclerView 设置item间隔和随机高度
- 卡片式ViewPager,一屏展示多个pager item,设置高度不一致的tabBar
- 最小无效listview 设置item高度
- 几种设置UITableView的cell动态高度的方法
- There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key ''.
- 设置gridview里面item的高度
- NavigationViewController的backBarButtonItem的设置技巧 ...
- 动态设置TextView高度和宽度
- List Control 可编辑任意item文本,设置行高
- 如何使用代码动态的获取和设置ImageView的宽度和高度?
- sharepoint listItem设置权限
- LIST_VIEW_和LVITEM用法
- NavigationViewController的backBarButtonItem的设置技巧
- 如何动态的获取和设置ImageView的宽度和高度?
- android 滚动 变黑 list view item