2012-02-14 153 views
1

我是新的Android編程編程。我正在尋找任何關於Android編程的信息。現在我想知道如何改變 - 例如,考慮到屏幕尺寸的按鈕尺寸。通過屏幕尺寸更改LinearLayout

舉個例子,我有:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_gravity="center_vertical" 
    android:baselineAligned="false" 
    android:layout_marginLeft="40px" 
    android:layout_marginRight="40px" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 
</LinearLayout> 

現在我需要這個佈局電話:

android:layout_marginLeft="40px" 
android:layout_marginRight="40px" 

,但是否會有一個平板電腦,然後我需要

android:layout_marginLeft="200px" 
android:layout_marginRight="200px" 

我怎麼能做到這一點?

此外,如果您已經收藏瞭如何處理方向的好教程,請分享。

謝謝。

回答

0

建議您不要使用PX,而應該使用DP即密度獨立像素。 對於定位支持,您應該聲明單獨的佈局xml。

0
use dp instead of px for specifying margins and all.and try to use this in manifest file like this <supports-screens 
     android:anyDensity="true" 
     android:largeScreens="true" 
     android:normalScreens="true" 
     android:resizeable="true" 
     android:smallScreens="true" 
     />