【发布时间】:2012-12-29 07:28:24
【问题描述】:
我创建了一个布局文件。里面还有其他布局。 其中还有一个列表视图。我给它固定高度。 它在我的屏幕上工作正常,但是当我们将它用于其他屏幕尺寸时 它没有完整显示。它如何适用于所有尺寸的设备。 代码如下。
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg" >
<include
android:id="@+id/mainScreenHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="@layout/main_screen_header" />
<include
android:id="@+id/mainScreenListHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/mainScreenHeader"
layout="@layout/main_screen_list_header" >
</include>
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="270dp"
android:layout_below="@+id/mainScreenListHeader"
android:cacheColorHint="#00000000"
android:drawSelectorOnTop="false" />
<include
android:id="@+id/mainScreenFilterClient"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/list"
android:layout_marginTop="10dp"
layout="@layout/main_screen_filter_client" >
</include>
<include
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/mainScreenFilterClient"
android:layout_marginTop="10dp"
layout="@layout/footer" >
</include>
</RelativeLayout>
【问题讨论】:
-
尝试使用 android:weight ,以便您的列表视图可以根据您的屏幕尺寸调整大小。
标签: android listview layout android-relativelayout