0

我有从 sd 卡加载所有音频文件的 listview...有很多文件..但是 listview 看起来很糟糕..每个行高都会自动调整大小取决于行中显示的项目名称..背景是白色的,文本是灰色的所以很难注意到它......我想将每一行高度设置为相同,所以它看起来像这样在此处输入图像描述

这是我的代码

    <?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>
4

2 回答 2

1

在您的组 row.xml 中 ,而不是android:layout_height="wrap_content"列表视图的行高给出一个固定的高度..这将解决您的问题......像这样的东西 android:layout_height="50dp"

于 2013-02-10T12:30:02.380 回答
0

使用自定义列表视图。为一个列表视图项创建布局。在其中设置高度。在 .java 文件中应用适配器。然后它工作正常。我做了同样的事情,它对我有用。

于 2013-02-10T12:45:00.743 回答