0

ここに画像の説明を入力

レポートレイアウト用の私のxml :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:orientation="vertical" >
<ListView
        android:id="@+id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

    </ListView>

<TextView
    android:id="@+id/android:empty"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:text="@string/main_no_items"/>

</LinearLayout>

画像で見たように、リスト項目間に不必要な距離があります。リストアイテム間の距離を最小限に抑えるためにあらゆることを試みますが、減少することはありません:( 2つのアイテム間に隙間がないようにしたい.分割線以外に隙間がないように、1つのリストアイテムの後に次のアイテムを取得する方法を教えてください.

4

4 に答える 4

1

そのギャップは、でLinearLayout使用している背景が原因ですrow layout。その背景画像の高さが非常に長いため、2つのアイテム間のギャップが表示されます。必要なものを実現するには、背景画像の高さを低くしてみてください。

于 2013-01-02T11:31:28.747 に答える
0

行のルートレイアウトから背景を削除し、に適用しますlistview

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="?android:attr/listPreferredItemHeight"
      android:background="@drawable/background"  <===== Remove background
      android:orientation="vertical" >

レポートレイアウトに適用します

<ListView
    android:id="@+id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
     android:background="@drawable/background" /> <=== Try applying background in listview.
于 2013-01-02T11:11:10.997 に答える
0

を変更してみてください

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="@drawable/background"
android:orientation="vertical" >

android:layout_height="wrap_content"
于 2013-01-02T11:01:11.893 に答える
0

raw_layout で背景を設定しないでください。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="@drawable/background"         <-----  remove this line
android:orientation="vertical" >
于 2013-01-02T11:03:26.797 に答える