列表视图高度
我有列表视图,从SD卡加载所有音频文件...有很多文件..但列表视图看起来坏坏..每一行高度自动调整大小取决于项目名称显示在行..background是白色和文字是灰色的,所以很难注意到它......我想设置每一行高度一样的,所以它看起来像这样列表视图高度
这里是我的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="@+id/PhoneMusicList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</ListView>
</LinearLayout>
在组一行。 xml 而不是android:layout_height="wrap_content"
为listview行高给一个固定的高度..这将解决您的问题...... 这样的东西 android:layout_height="50dp"
不会修复listview本身的高度。 – 2013-02-10 12:30:40
已更新的答案.. – Pragnani 2013-02-10 12:32:31
是的这应该工作.. – 2013-02-10 12:33:18
使用自定义列表视图。创建一个列表视图项目的布局。在那里设置高度。在.java文件中应用适配器。然后它工作正常。我做了同样的事情,它适用于我。
我认为你可以使用自定义列表视图,在那里你可以修复列表项的高度 – 2013-02-10 12:29:03