2012-01-14 89 views
0

我想提出一个Android应用程序,它的main.xml文件是这样的:布局越来越分心?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/background_full"> 

     <Button android:id="@+id/nxt_btn" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:layout_marginLeft="170dp" 
      android:layout_marginTop="100dp" 
      android:background="@drawable/button_background"/> 

    <Button android:id="@+id/back_btn" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:layout_marginLeft="360dp" 
      android:layout_marginTop="100dp" 
     android:background="@drawable/button_background"/> 

     <com.broov.player.DrawView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/drawingSurface" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
     android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="true" 
      android:visibility="visible" /> 
</RelativeLayout> 

在我的模拟器它的正常工作,但是当设备或模拟器的分辨率更改布局变得心烦意乱。我需要布局对每台机器都是通用的。

回答

0

您需要指定布局中组件的关系:toLeftOf或toRightOf。