I want a button to appear at fixed location all the time, in the footer of the UI ؟ ( always, if it has components above it or not )
A simple problem but many new developers don't know how to do this. Set CSS Position property to fixed, bottom and right properties to 0px. Use cases : A feedback button or a chat window.
From Settings, go to System, Gestures, and then tap System Navigation. Gesture navigation will be selected by default, but you can tap 3-button navigation to make buttons appear at the bottom of your screen.
You can set the android:layout_weight='1' and both buttons will share the screen equally(side by side) or if you want the extra space between them, you can place a button each in a linear layout and set the android:layout_gravity to left and right for each. Save this answer.
Please take one Relative layout under your main layout . Set its height and width as fill parent and set its gravity as bottom and put any textview or any button you want in it.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Bottom Gravity" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Without Gravity" />
</LinearLayout>
</FrameLayout>
Put
android:layout_alignParentBottom="true"
in your relative layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With