我正在开发一个应用程序。需要的是,我想创建一个如图所示的布局:
在此,我采用了一个相对布局,我将图像作为背景。图像没有红点(按钮)。
我将红色按钮作为图像按钮放置在固定位置。当我在我的 Galaxy s2 上运行它时,它看起来很好并且工作也很好。
但是当我在我的 LG Optimus L3 E400 上测试这个布局时。红色按钮不在我设置的位置。
布局代码为:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background" >
<TextView
android:id="@+id/textview_navigationbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/navigationbar"
android:text="@string/string_map"
android:gravity="center"
android:textIsSelectable="false" />
<RelativeLayout
android:layout_below="@+id/textview_navigationbar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="50sp"
android:layout_marginBottom="50sp"
android:background="@drawable/map">
<ImageButton
android:id="@+id/imagebutton_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="100dip"
android:layout_marginLeft="50dip"
android:background="@drawable/button_1" />
<ImageButton
android:id="@+id/imagebutton_2"
android:layout_below="@+id/imagebutton_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dip"
android:layout_marginLeft="6dip"
android:background="@drawable/button_2" />
<ImageButton
android:id="@+id/imagebutton_3"
android:layout_below="@+id/imagebutton_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="1dip"
android:layout_marginLeft="40dip"
android:background="@drawable/button_3" />
</RelativeLayout>
</RelativeLayout>
在我的 LG Optimus L3 E400 中,它看起来像:
红色按钮不在位置上。我不想为此使用地图视图,因为我不知道并且从未使用过它。
请指导我如何摆脱这个问题。至于如何为最大分辨率和屏幕支持创建布局。