当listview的item为相对布局时item高度被挤压解决
2016-01-04 16:39
274 查看
在item的layout文件中,用android:layout_height设置item的高度。
运行,高度设置无效。
解决办法:
给item设定minHeight,即可.
---------------------------------------
最近一直纠结于ListView中每个Item中高度的问题,在网上只找出一个方法,就是在每个item里面加入图片,也就是ImageView,这样用图片来“撑”它的高度,这样实在是费劲,不可也可以解决问题
今天无意间看SDK里面的Demo,发现还有一种方法,如下黑色粗体所示
运行,高度设置无效。
解决办法:
给item设定minHeight,即可.
---------------------------------------
最近一直纠结于ListView中每个Item中高度的问题,在网上只找出一个方法,就是在每个item里面加入图片,也就是ImageView,这样用图片来“撑”它的高度,这样实在是费劲,不可也可以解决问题
今天无意间看SDK里面的Demo,发现还有一种方法,如下黑色粗体所示
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" <strong> android:minHeight="?android:attr/listPreferredItemHeight"</strong> > <TextView android:id="@+id/tv" android:layout_width="fill_parent" android:layout_height="20dp" android:text="@string/hello" /> </LinearLayout>
相关文章推荐
- APP留存率
- 数据库第五章理论总结
- 第十个项目
- lightning mdb 源代码分析(4)&mdash;MVCC/COW
- linux中添加开机自启服务的方法
- 织梦翻页分页css代码案例分享(转载)
- 使用Metronic开发的后台管理系统的基础架构(bootstrap 3.3.5)
- JavaScript设计模式 --- 封装和信息隐藏
- lightning mdb 源代码分析(5)-事务控制
- Isomap等距映射算法(1)
- Android学习笔记--ListView的三种使用方式
- MongoDB-Manual-Master 读书笔记-简介及安装
- SQLite之SQLITE_BUSY与sqlite3_busy_handler()
- 如何使进程不被360软件Kill掉?(解决方案)
- window.location.reload();页面实现跳转和刷新
- 延长启动页时间
- Webkit内核探究【1】——Webkit简介
- lightning mdb 源代码分析(5)-事务控制
- 配置springMVC之后,引入js,css等资源处理
- 2016年04月MVP开始申请了~[截止时间:1月12日]