2012-02-14 4 views
1

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

、代わりにあなたは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" 
     /> 
関連する問題