Search code examples
androidxmlandroid-studiofixed

Android Studio: Fixed footer that's locked to bottom


I'm currently working on a layout in Android Studio but there's a problem that I need to fix.. I want to make my layout be locked to the bottom, just like Facebook which has a layout-bar at the bottom, no matter how much you scroll, it wont move.

Right now my code looks like this, but the "goButtonLayout" keeps going out of screen.. Anyone got an idea?

<LinearLayout    
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:flatui="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical"
android:nestedScrollingEnabled="true"
android:paddingBottom="20dp"
android:id="@+id/content">


<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="16dp"
    android:id="@+id/contentLayout">


    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:id="@+id/searchngo">



        <com.cengalabs.flatui.views.FlatEditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editBox"
            android:textColor="#fff"
            android:text="@+string/choose"
            flatui:fl_fontWeight="bold"
            flatui:fl_fieldStyle="0"
            flatui:fl_blockButtonEffectHeight="3dp"
            android:longClickable="false"
            android:layout_marginBottom="2dp"
            android:layout_gravity="left"
            android:paddingRight="60dp"
            android:paddingLeft="12dp"
            android:paddingTop="12dp" />


        <com.cengalabs.flatui.views.FlatButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            flatui:fl_touchEffect="fl_ripple"
            android:text="@+string/addRow"
            android:id="@+id/newRow"
            flatui:fl_blockButtonEffectHeight="3dp"
            android:clickable="true"
            android:layout_marginLeft="16dp" />


    </LinearLayout>

    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/scrollView3" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:paddingBottom="24dp">

        <com.cengalabs.flatui.views.FlatButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/search"
            android:id="@+id/test111"
            flatui:fl_touchEffect="fl_ripple"
            flatui:fl_blockButtonEffectHeight="3dp"
            android:clickable="true"
            android:layout_marginTop="16dp" />

        <com.cengalabs.flatui.views.FlatButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/search"
            android:id="@+id/test666"
            flatui:fl_touchEffect="fl_ripple"
            flatui:fl_blockButtonEffectHeight="3dp"
            android:clickable="true"
            android:layout_marginTop="16dp" />

        <com.cengalabs.flatui.views.FlatButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/search"
            android:id="@+id/test333"
            flatui:fl_touchEffect="fl_ripple"
            flatui:fl_blockButtonEffectHeight="3dp"
            android:clickable="true"
            android:layout_marginTop="16dp" />

        <com.cengalabs.flatui.views.FlatButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/search"
            android:id="@+id/test6532"
            flatui:fl_touchEffect="fl_ripple"
            flatui:fl_blockButtonEffectHeight="3dp"
            android:clickable="true"
            android:layout_marginTop="16dp" />


        <com.cengalabs.flatui.views.FlatButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/search"
            android:id="@+id/test6123"
            flatui:fl_touchEffect="fl_ripple"
            flatui:fl_blockButtonEffectHeight="3dp"
            android:clickable="true"
            android:layout_marginTop="16dp" />

        <com.cengalabs.flatui.views.FlatButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/search"
            android:id="@+id/test512"
            flatui:fl_touchEffect="fl_ripple"
            flatui:fl_blockButtonEffectHeight="3dp"
            android:clickable="true"
            android:layout_marginTop="16dp" />

        <com.cengalabs.flatui.views.FlatButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/search"
            android:id="@+id/test123123"
            flatui:fl_touchEffect="fl_ripple"
            flatui:fl_blockButtonEffectHeight="3dp"
            android:clickable="true"
            android:layout_marginTop="16dp" />


    </LinearLayout>

</LinearLayout>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/goButtonLayout">


    <com.cengalabs.flatui.views.FlatButton
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/search"
        android:id="@+id/goButton"
        flatui:fl_touchEffect="fl_ripple"
        flatui:fl_blockButtonEffectHeight="3dp"
        android:clickable="true"/>

</LinearLayout>


Solution

  • Try like this better to use Relative Layout for this enter image description here