Android Lollipop LinearLayout on the bottom of the screen



I have this problem only on Lollipop, older versions work (4.0 to 4.X).


In my xml, i have 3 parts :



  • First part : An ImageView with TextView.

  • Second part : A ListView

  • Third : A bottom bar with Buttons in a LinearLayout (horizontal)


Problem : In Android Lollipop Device, the third part is missing and ListView go to end of the screen.


Theme used : Theme.AppCompat.Light.NoActionBar (to colorize the MediaRouteButton in grey)


XML Code :



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:app="http://ift.tt/GEGVYd"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

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

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<ImageView
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="@dimen/cover"
android:layout_marginTop="0dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/default_cover" />

And other stuff...

</LinearLayout>

<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_weight="1"
android:clipToPadding="false"
android:divider="@android:color/transparent"
android:dividerHeight="15.0sp"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:scrollbars="none" />

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#f0f0f0"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:paddingTop="5dp"
android:weightSum="10">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left">

<ImageView
android:id="@+id/imageView4"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/img1" />

</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="10"
android:gravity="center">

<SeekBar
android:id="@+id/bar_vol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginRight="5dp" />

</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right">

<ImageView
android:id="@+id/imageView5"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/img2" />

<android.support.v7.app.MediaRouteButton
android:id="@+id/media_route_menu_item"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginLeft="10dp"
android:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
android:background="@android:color/transparent"
android:showAsAction="always"
android:title="Cast" />

</LinearLayout>

</LinearLayout>

</LinearLayout>

</LinearLayout>
</RelativeLayout>


Do you have an idea of where the problem is ?


No comments:

Post a Comment