Edit: I changed the title because isn't about MPAndroidChart, the same issue would happen with another view below the ListView.
I am trying to set a layout for an activity in my android app. This activity consist on 2 elements, a ListView and a MPAndroidChart.
What I would like to achieve is to place the ListView at top, taking the height that it needs (wrap_content) and below it the chart with a fixed height.
I'm newbie on android, so the first thing I made was make a RelativeLayout with the list on the top and below that, the chart. This seemed fine in 'portrait' (the list had few element) but when I tried it on 'landscape' the chart disappeared...
So then I made a ScrollView wrapping the whole content (that it's a RelativeLayout) but I experimented some strange behavior (I guess because of the dynamic height of the listview). But anyway, the idea of having two different 'scrolls' (one for the list, another one for the whole activity) doesn't seem very nice.
Well, what I'm doing now is divide the height in two and have on the top part, the list, and on the bottom, the chart, like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="2"
android:orientation="vertical" >
<ListView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:id="@+id/list"
android:listSelector="@android:color/transparent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</ListView>
<com.github.mikephil.charting.charts.LineChart
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_below="@+id/list"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>
But I don't really like it.
So, any thoughts on how to do this?

