我想设计像下面的图片的布局:
I want to design a layout like the image below:
我试着使用相对布局做到这一点,但我没有拿出一个解决方案。它应该是在对所有设备屏幕的相同位置上。我怎样才能实现呢??? 我想这code:
I tried to do it using Relative layout but I did not come up with a solution. It should be in the same position for all device screen. How can I achieve it??? I tried this code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relative_layout_top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/obaz" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/relative_layout_bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/relative_layout_top"
android:background="@drawable/obaz2" >
<Button
android:id="@+id/bt_atoz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="-20dp"
android:background="@drawable/button_active" />
</RelativeLayout>
</RelativeLayout>
任何建议将AP preciated。
Any suggestion will be appreciated.
您可以把按钮
声明你的 RelativeLayout的 relative_layout_bottom
然后将它放在你喜欢的地方。
You can put the Button
declaration outside of your RelativeLayout
relative_layout_bottom
and then place it where you like.
例如: 编辑:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/relative_layout_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/obaz" >
</RelativeLayout>
<Button
android:id="@+id/bt_atoz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/button_active" />
<RelativeLayout
android:id="@+id/relative_layout_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/relative_layout_top"
android:background="@drawable/obaz2" >
</RelativeLayout>
</RelativeLayout>