2013-01-17 73 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