简体   繁体   中英

Listview height

I have listview that loads all audio files from sd card...there is alot of files..but listview looks prety bad..every row height automatically resizes depends of item name that shows in row..background is white and text is grey so it is hard to notice it...I want to set every row height to same so it looks like this 在此处输入图片说明

here is my code

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

在您的组中row.xml而不是android:layout_height="wrap_content"为列表视图的行高提供固定的高度。这将解决您的问题……类似android:layout_height="50dp"

Use the customize list view. Create a layout for one list view item. Set the height in that. Apply adapter in .java file. Then it works fine. I done the same thing and it works for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM