2012-02-09 8 views
1

メインレイアウト内に相対レイアウトが1つあるレイアウトがあります。このレイアウトはメインレイアウトの中央に表示されます。一部のデバイスではほとんどの部分をカバーしています私はそれがすべての画面(つまり、すべてのエミュレータ)の同じ部分をカバーする必要があります。レイアウトを使用することができます:体重?どんな良いアイデアですか?異なる画面にもかかわらず画面をカバーするためのビューを作成する方法

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    style="@style/ViewScreenTheme" 
    android:orientation="vertical" 
    android:background="@drawable/background" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <RelativeLayout android:id="@+id/header" 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_horizontal" 
    android:paddingTop="10dp" 
    android:paddingBottom="10dp"> 

    <Button android:id="@+id/help_button" 
     android:layout_alignParentRight="true" 
     style="@style/ButtonText" 
     android:layout_margin="1dp" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:background="@drawable/help_button" 
     android:paddingLeft="10px" 
     android:paddingRight="10px" 
     android:layout_marginRight="10px"/> 
    </RelativeLayout> 
    <RelativeLayout android:id="@+id/root" 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:gravity="center_horizontal" 
    android:layout_below="@+id/header" 
    android:layout_marginTop="2dp" 
    android:layout_marginBottom="0dp" 
    android:paddingTop="10dp" 
    android:paddingBottom="10dp"> 
    <RelativeLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="384dp" 
     android:background="#0fff" 
     android:id="@+id/canvas_layout"> 
    </RelativeLayout> 
    </RelativeLayout> 
</RelativeLayout> 
</LinearLayout> 

私はすべての画面の一部をカバーする最後の相対レイアウトであるcanvas_layoutが必要です。

+1

xmlファイルのコードを提供pls – Jin35

+0

レイアウトXMLファイルを投稿する必要があります。 –

+0

xmlファイルを追加しました。 –

答えて

0

私の意見では、画面のサイズを処理する最良の方法は、リソースの修飾子を使用してリソースを提供することです。ガイドラインhereを見つけることができます。

次に、必要なサイズのvaroiusレイアウトを指定する必要があります。

関連する問題