Reputation: 839
I'm having trouble placing the only button in my application at the bottom right corner of the screen. The code may be found below:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp" >
<ExpandableListView
android:id="@+id/exp_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#A4C739"
android:dividerHeight="0.5dp"
android:indicatorLeft="?android:attr/expandableListPreferredItemPaddingLeft" >
</ExpandableListView>
<Button
android:id="@+id/btnDisplayMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/exp_list"
android:layout_below="@+id/exp_list"
android:layout_marginLeft="40dp"
android:gravity="bottom"
android:text="@string/next" />
</RelativeLayout>
Upvotes: 0
Views: 63
Reputation: 378
Try this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp" >
<ExpandableListView
android:id="@+id/exp_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#A4C739"
android:dividerHeight="0.5dp"
android:layout_marginBottom="60dp"
android:indicatorLeft="?android:attr/expandableListPreferredItemPaddingLeft" >
</ExpandableListView>
<Button
android:id="@+id/btnDisplayMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="@string/next" />
</RelativeLayout>
Upvotes: 2
Reputation: 22008
This should point you in the right direction:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp"
android:paddingBottom="16dp">
<Button
android:id="@+id/btnDisplayMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="@string/next" />
<ExpandableListView
android:id="@+id/exp_list"
android:layout_above="@id/btnDisplayMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#A4C739"
android:dividerHeight="0.5dp"
android:indicatorLeft="?android:attr/expandableListPreferredItemPaddingLeft">
</ExpandableListView>
</RelativeLayout>
Upvotes: 0