【发布时间】:2013-01-31 16:56:58
【问题描述】:
我有一个屏幕更大的模拟器,一切正常。 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>
【问题讨论】:
-
您的 imo 布局没有问题。
-
@Aerilys 我也是这么想的。但一切都在更大的屏幕上运行,那么问题出在哪里?
标签: java android xml layout screen-size