Reputation: 43
How can i set the Button on the android XML on the bottom of linear layout and also at the center of the bottom ? Thanks in advance !
<Button
android:layout_gravity="center"
/>
Upvotes: 0
Views: 176
Reputation: 1048
See if it is what are looking for :
<?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" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</RelativeLayout>
Upvotes: 0
Reputation: 8853
if you are using relative layout...
you can do something like this
If you have a relative layout that fills the whole screen you should be able to use android:layout_alignParentBottom
to move your view to the bottom of the screen.
then set layout_marginleft
to your desired value to set it to center
Upvotes: 1