0

私はより大きな画面のエミュレーターを持っていました、そしてそれはすべてうまくいきます。ListViewすべてが完全に正常であるため、Javaコードには含まれていません。3.2画面でテストしてみましたが、何も表示されListViewません。小さい画面(3.2)のエミュレーターで試してみましたが、何も表示されなかったので、これはレイアウトと関係があると思います。

私のlistview.xmlレイアウト:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="150dp" >

    </ListView>

</LinearLayout>

行xmlファイル:

  <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/text1"
        android:layout_width="match_parent"        
        android:gravity="center"
        android:layout_height="30dp" />

</LinearLayout>
4

1 に答える 1

1

ListViewのwrap_contentにandroid:layout_widthとandroid:layout_heightを設定しないでください。

于 2013-01-31T17:06:56.537 に答える