android解决无法设定listview的item高度(设置行高)
16lz
2021-01-23
原地址:http://blog.csdn.net/tianshuguang/article/details/38395979
在item的layout文件中,用android:layout_height设置item的高度。
运行,高度设置无效。
解决办法:
给item设定minHeight,即可.
---------------------------------------
[html] view plain copy
- <?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="50dip"
- android:minHeight="?android:attr/listPreferredItemHeight"
- >
- <TextView
- android:id="@+id/tv"
- android:layout_width="fill_parent"
- android:layout_height="20dp"
- android:text="@string/hello"
- />
- LinearLayout>
更多相关文章
- Android 获取控件高度宽度三种方法,防止0的出现
- Android中MAC地址获取代码
- android x86 iso 下载地址 google 官方下载
- Android配置ip地址
- 【Android】 dialog 设置maxHeight 最大高度
- android根据屏幕高度改变item占ListView高度
- Android 子控件高度超出父布局的限制
- 获取Android屏幕尺寸、控件尺寸、状态栏/通知栏高度、导航栏高度