我正在開發一個應用程序。我們需要的是因爲,我想創建一個佈局如圖所示:創建圖像佈局
在此,我參加了一個相對佈局,而我給了一個圖片作爲背景。 圖像沒有紅點(按鈕)。
我將紅色按鈕作爲圖像按鈕放置在固定位置。當我在銀河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