I have Activity with the header, the menu and the footer. In vertical orientation of the screen the Footer is at the bottom of the ScrollView
, but it should be fixed at the bottom of the screen. There must be a free space between the ScrollView
and the Footer in vertical orientation.
How to make that the Footer be fixed at the bottom of the screen in vertical orientation?
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.test.test.MainMenuActivity">
<LinearLayout
android:background="@color/colorMainWhite"
style="@style/root_layout">
<!--- Header-->
<include layout="@layout/content_header"/>
<include layout="@layout/content_subheader"/>
<!--- Menu with scroll-->
<ScrollView
android:id="@+id/myview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="@+id/merchantInfoLayout"
android:paddingTop="@dimen/size_15px"
android:orientation="vertical"
style="@style/los_lo_merchant_info_item">
<TextView
android:id="@+id/tvNL1"
tools:text="test"
style="@style/tvs_lo_text_32_bold_ellipsized"/>
<TextView
android:id="@+id/tvNL2"
tools:text="test"
style="@style/tvs_lo_text_26_ellipsized"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="@+id/button1"
style="@style/los_lo_mainmenu_item">
<ImageView
style="@style/icon_default_size_center"
android:src="@drawable/icon_1"/>
<TextView
style="@style/tvs_lo_text_mainmenu_button"
android:text="@string/title_item_1"/>
</LinearLayout>
<LinearLayout
android:id="@+id/button2"
style="@style/los_lo_mainmenu_item">
<ImageView
style="@style/icon_default_size_center"
android:src="@drawable/icon_2"/>
<TextView
style="@style/tvs_lo_text_mainmenu_button"
android:text="@string/title_item_2"/>
</LinearLayout>
<LinearLayout
android:id="@+id/button3"
style="@style/los_lo_mainmenu_item">
<ImageView
style="@style/icon_default_size_center"
android:src="@drawable/icon_3"/>
<TextView
style="@style/tvs_lo_text_mainmenu_button"
android:text="@string/title_item_3"/>
</LinearLayout>
<LinearLayout
android:id="@+id/button4"
style="@style/los_lo_mainmenu_item">
<ImageView
style="@style/icon_default_size_center"
android:src="@drawable/icon_4"/>
<TextView
style="@style/tvs_lo_text_mainmenu_button"
android:text="@string/title_item_4"/>
</LinearLayout>
<LinearLayout
android:id="@+id/button5"
style="@style/los_lo_mainmenu_item">
<ImageView
style="@style/icon_default_size_center"
android:src="@drawable/icon_5"/>
<TextView
style="@style/tvs_lo_text_mainmenu_button"
android:text="@string/title_item_5"/>
</LinearLayout>
<LinearLayout
android:id="@+id/button6"
style="@style/los_lo_mainmenu_item">
<ImageView
style="@style/icon_default_size_center"
android:src="@drawable/icon_6"/>
<TextView
style="@style/tvs_lo_text_mainmenu_button"
android:text="@string/title_item_6"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<!--- Footer-->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:gravity="bottom">
<LinearLayout
android:paddingTop="@dimen/size_20px"
android:paddingBottom="@dimen/size_20px"
android:background="@color/colorBgLightGrey"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:layout_height="wrap_content">
<ImageView
android:src="@drawable/icon_logos_ips"
style="@style/ips_icons_style"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
You will have to expand one of your upper views to fill the remaining space by setting
android:layout_weight="1"
on it. This will push your last view down to the bottom.check this link
below is your layout :
the bottom now and not overlap with the content of the scrollview. It will appear like this: