2012-02-14 152 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" 
     />