В моем макете это не перемещение кнопки справа от экрана.Что мне не хватает?Кнопка находится в линейном макете.Но имеет свою относительную компоновку.
Попробуйте, у меня все работает.
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <LinearLayout android:orientation="vertical" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"> <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right"> </Button> </LinearLayout> </RelativeLayout>
Примерно так: main.xml.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="right" > <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"> android:layout_alignParentRight="true" android:text="Right Button" </Button> </RelativeLayout> </LinearLayout>
Приветствие.
Установите для RelativeLayout android: width значение «fill_parent», для LinearLayout установите для свойства android: layout_gravity значение «right»