Android的ListView项的高度 [英] android listview item height

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

问题描述

为什么当我使用SimpleCursorAdapter的ListView中我有一个项目高度的ListView这样的 -

(我的code根据<一href="http://stackoverflow.com/questions/2982948/sqlite-and-populating-list-view-android">this)

但是,使用数组列表视图时,项目具有很大的高度

(我学的ListView基于这个

有关项目列表视图行布局

 &LT; XML版本=1.0编码=UTF-8&GT?;
&LT; TextView的机器人:ID =@ + ID / text1中
的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT/&GT;
 

所以,我的问题是为什么会出现使用ArrayAdapter和SimpleCursorAdapter当行高的差异?

解决方案

 安卓textAppearance =机器人:ATTR / textAppearanceLarge
 

似乎没有影响。

 安卓=了minHeight机器人:ATTR /列表preferredItemHeight
 

改变高度,我

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天全站免登陆