2012-07-31 72 views
0

我正在使用android2.2.I創建了drawable-mdpi,drawable-hdpi,res/drawable-xhdpi。 我創建了大,中,小屏幕大小的佈局文件夾。我在清單文件中使用。即使我無法獲得對多個屏幕大小的支持。例如,大,中,小屏幕大小的圖像大小和佈局邊距保持不變。誰能幫我?如何爲android佈局設計支持多個屏幕

+1

閱讀本http://developer.android.com/guide/practices/screens_support.html – 2012-07-31 08:08:54

+1

我也只用一個佈局文件夾 – 2012-07-31 08:10:20

+0

沒有,你應該使用多個佈局文件,佈局XLARGE土地進行了測試,layout-xlarge,layout-land,layout-port like this – 2012-07-31 08:11:50

回答

1

名稱佈局文件夾與佈局小,佈局正常,佈局大,layoutxx.It工作根據移動dpi.It不依賴於屏幕大小。

0

如果你想爲所有屏幕創建佈局,你可以使用權重來管理它們。

此示例代碼可能會幫助你。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:weightSum="1.0" > 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="0dp" 
     android:layout_weight="0.3" 
     android:src="@drawable/ic_launcher" /> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="0.4" 
     android:orientation="vertical" 
     android:weightSum="1.0"> 



    </LinearLayout> 

</LinearLayout>