2013-01-17 176 views
0

我已经创建了一个android应用程序。它是根据屏幕尺寸320 * 480。但是当我使用不同的设备时,屏幕尺寸设计不尽相同。我该如何解决这个问题。请建议如何创建适合所有屏幕尺寸的设计。 我目前的布局是: -布局不适应所有屏幕尺寸

<LinearLayout 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" 
android:orientation="vertical" 
android:weightSum="2.0" > 

<include 
    android:id="@+id/mainScreenHeader" 
    android:layout_width="fill_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.4" 
    layout="@layout/main_screen_header" /> 

<include 
    android:id="@+id/mainScreenListHeader" 
    android:layout_width="fill_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.1" 
    layout="@layout/main_screen_list_header" > 
</include> 

<ListView 
    android:id="@+id/list" 
    android:layout_width="fill_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1.0" 
    android:cacheColorHint="#00000000" 
    android:drawSelectorOnTop="false" /> 

<include 
    android:id="@+id/mainScreenFilterClient" 
    android:layout_width="fill_parent" 
    android:layout_height="0dp" 
    android:layout_marginTop="10dp" 
    android:layout_weight="0.2" 
    layout="@layout/main_screen_filter_client" > 
</include> 

<include 
    android:id="@+id/footer" 
    android:layout_width="fill_parent" 
    android:layout_height="0dp" 
    android:layout_weight="0.2" 


    layout="@layout/footer" > 
</include> 

+0

请提一下您当前的布局 – Riskhan

回答

0

这是在Android发展的挑战之一。有许多不同的Android设备具有许多不同的显示特性。开发者指南给出了这个主题的一个很好的概述:

http://developer.android.com/guide/practices/screens_support.html

也许你会想要做的,是为不同的屏幕提供了不同的布局。以上链接讨论了这种方法。

0

首先,this link将有助于了解如何支持多种熨平板尺寸。

最好是文件夹添加到资源文件夹中的Android项目,以支持多种分辨率,如:

布局大

布局小

布局XLARGE

布局 - normal-port-xhdpi-1280x800