为什么当我在ListView中使用SimpleCursorAdapter时,我在ListView中的项目高度是这样的--
(我的代码基于this)
,但在使用数组时,列表视图项具有较大的高度
(我学习了基于this的listview )
项目列表视图的行布局为
<?xml version="1.0" encoding="utf-8"?>
<TextView android:id="@+id/text1"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
所以我的问题是,为什么使用ArrayAdapter和SimpleCursorAdapter时,行高会有差异?
发布于 2010-11-25 15:10:47
android:textAppearance="?android:attr/textAppearanceLarge"
似乎没有效果。
android:minHeight="?android:attr/listPreferredItemHeight"
为我更改了高度
发布于 2011-09-10 07:19:34
对我来说,诀窍不是设置高度,而是设置minHeight。这必须应用于您的自定义适配器用于呈现每一行的任何布局的根视图。
发布于 2012-05-13 06:29:30
您需要在列表项布局上使用填充,以便在项的边缘添加空间(仅增加字体大小不会做到这一点)。
<?xml version="1.0" encoding="utf-8"?>
<TextView android:id="@+id/text1"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp" />
https://stackoverflow.com/questions/4243894
复制相似问题