White empty space in Android Layout fragment -


in android app have login screen works fine far. structured in root scrollview, has vertical linearlayout names rootlayer. in rootlayer, have 4 consecutive linearlayout's can see in following xml layout file. show 3 @ same time. depending on if logged in or off, either 1st (loggedofflayer) or 2nd (loggedinlayer) layer; and 3rd , fourth 4th (grey color) always:

<?xml version="1.0" encoding="utf-8"?>  <scrollview xmlns:android="http://schemas.android.com/apk/res/android"              xmlns:app="http://schemas.android.com/apk/res-auto"              xmlns:tools="http://schemas.android.com/tools"              android:layout_width="match_parent"              android:layout_height="match_parent"              android:fillviewport="true"              android:padding="0dp"      >        <linearlayout          android:id="@+id/rootlayer"          android:layout_width="match_parent"          android:layout_height="wrap_content"          android:animatelayoutchanges="true"          android:clickable="true"          android:focusable="true"          android:focusableintouchmode="true"          android:orientation="vertical"          android:padding="0dp"          >            <linearlayout              android:id="@+id/loggedofflayer"              android:layout_width="match_parent"              android:layout_height="wrap_content"              android:orientation="vertical"              tools:visibility="visible">  	    <!-- 1 2 views , buttons-->          </linearlayout>            <linearlayout              android:id="@+id/loggedinlayer"              android:layout_width="match_parent"              android:layout_height="wrap_content"              android:layout_below="@id/loggedofflayer"              android:orientation="vertical"              android:visibility="gone"              tools:visibility="visible">              <!-- labels, textviews , buttons -->          </linearlayout>            <linearlayout              android:id="@+id/about_container"              android:layout_width="match_parent"              android:layout_height="wrap_content"              android:layout_above="@+id/bottomlayer"              android:layout_marginbottom="@dimen/grid1"              android:gravity="center"              android:orientation="horizontal"              tools:visibility="visible">              <!-- labels text -->          </linearlayout>              <linearlayout              android:id="@+id/bottomlayer"              android:layout_width="match_parent"              android:layout_height="120dp"              android:background="@color/light_background"              android:orientation="vertical">              <!-- imageviews , labels pictures , legal text-->          </linearlayout>        </linearlayout>  </scrollview>

when logged in every thing fine. when logged off, in following screenshot, there white empty space (red arrow) after last layer (grey).

how can stick last layer bottom, there no white stripe in every case?

try code:---

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="2" android:fillviewport="true" >  <scrollview     android:layout_width="match_parent"     android:layout_height="0dp"     android:layout_weight="1.8">      <linearlayout         android:id="@+id/rootlayer"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:animatelayoutchanges="true"         android:clickable="true"         android:focusable="true"         android:focusableintouchmode="true"         android:orientation="vertical"         android:padding="0dp">          <linearlayout             android:id="@+id/loggedofflayer"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:orientation="vertical"             tools:visibility="visible">             <!-- 1 2 views , buttons-->          </linearlayout>          <linearlayout             android:id="@+id/loggedinlayer"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_below="@id/loggedofflayer"             android:orientation="vertical"             android:visibility="gone"             tools:visibility="visible">             <!-- labels, textviews , buttons -->         </linearlayout>          <linearlayout             android:id="@+id/about_container"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_above="@+id/bottomlayer"             android:layout_marginbottom="15dp"             android:gravity="center"             android:orientation="horizontal"             tools:visibility="visible">             <!-- labels text -->         </linearlayout>         </linearlayout> </scrollview>  <linearlayout     android:id="@+id/bottomlayer"     android:layout_width="match_parent"     android:layout_height="0dp"     android:layout_weight=".2"     android:background="@color/black"     android:orientation="vertical">     <!-- imageviews , labels pictures , legal text-->   </linearlayout>  </linearlayout> 

using code bottomlayer stick @ bottom.


Comments