我已经放在按钮和ImageView的上RelativeLayout的,并且这些按钮完全有条件在Nexus 5:How it looks on Nexus 5如何将按钮链接到Image上的特殊位置?
不过在Nexus One上它改变了很多:How it looks on Nexus One
这里是我的XML代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
app:srcCompat="@drawable/main_menu_top" />
<ImageView
android:id="@+id/imageView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
app:srcCompat="@drawable/main_menu_center"
android:layout_below="@+id/imageView6" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/imageView6">
</RelativeLayout>
<Button
android:id="@+id/top_left_button"
android:layout_width="105dp"
android:layout_height="105dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/imageView6"
android:layout_marginLeft="77dp"
android:layout_marginStart="77dp"
android:layout_marginTop="38dp"
android:background="@drawable/button_main_menu_port"
android:text="Example" />
<Button
android:id="@+id/top_right_button"
android:layout_width="105dp"
android:layout_height="105dp"
android:background="@drawable/button_main_menu_port"
android:text="Example"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="80dp"
android:layout_marginEnd="80dp"
android:layout_alignBottom="@+id/top_left_button" />
<Button
android:id="@+id/bot_left_button"
android:layout_width="105dp"
android:layout_height="105dp"
android:layout_alignLeft="@+id/top_left_button"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/top_left_button"
android:layout_marginBottom="39dp"
android:background="@drawable/button_main_menu_port"
android:text="Example" />
<Button
android:id="@+id/bot_right_button"
android:layout_width="105dp"
android:layout_height="105dp"
android:layout_alignBottom="@+id/bot_left_button"
android:layout_alignLeft="@+id/top_right_button"
android:layout_alignStart="@+id/top_right_button"
android:background="@drawable/button_main_menu_port"
android:lines="2"
android:maxLines="2"
android:minLines="2"
android:text="Example" />
</RelativeLayout>
</LinearLayout>
但是,这些按钮需要位于此图像中的菱形位置。
您能张贴您的预期结果的图像吗? – FAT
检查Nexus 5的分辨率屏幕截图 – NullOne