android listview项目高度 [英] android listview item height

查看:36
本文介绍了android listview项目高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么当我为 ListView 使用 SimpleCursorAdapter 时,我在 ListView 中有这样的项目高度 -

(我的代码基于 学习listview)

项目列表视图的行布局是

所以我的问题是为什么在使用 ArrayAdapter 和 SimpleCursorAdapter 时行高会有差异?

解决方案

 android:textAppearance="?android:attr/textAppearanceLarge"

似乎没有效果.

 android:minHeight="?android:attr/listPreferredItemHeight"

为我改变了高度

Why when i use SimpleCursorAdapter for ListView i have items height in ListView like this -

(My code based on this)

But when using arrays Listview items have big height

(I learn listview based on this)

Row layout for item listview is

<?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"/>

So My question is why there is a difference in row heights when using ArrayAdapter and SimpleCursorAdapter?

解决方案

  android:textAppearance="?android:attr/textAppearanceLarge" 

seemed no effect.

  android:minHeight="?android:attr/listPreferredItemHeight" 

changed the height for me

这篇关于android listview项目高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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