我正在开发一个应用程序。我们需要的是因为,我想创建一个布局如图所示:创建图像布局
在此,我参加了一个相对布局,而我给了一个图片作为背景。 图像没有红点(按钮)。
我将红色按钮作为图像按钮放置在固定位置。当我在银河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擎天柱L3 E400,它看起来像:
红色按钮不在位置。 我不想使用地图视图,因为我不知道,也从来没有使用它。
请指导我如何摆脱这个问题。作为如何创建最大分辨率和屏幕支持的布局。
它不会是相同的。由于设备尺寸是不同的,因此将获得在该位置有所不同.. – itsrajesh4uguys 2013-05-03 10:45:05
@ itsrajesh4uguys:那么如何在来的吧。 – 2013-05-03 10:47:03
你需要使用画布或类似的东西来绘画... – itsrajesh4uguys 2013-05-03 10:57:05