I have a linearlayout with a listview in a relativelayout. Listview is visible, but the parent 2 buttons and textview are not. I cannot figure out why. I tried setting the linearlayout to bottom with
android:layout_alignParentBottom="true"
but that did not work, can anyone tell me why I can only see my listview and nothing else.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/date"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
<Button
android:id="@+id/exercise"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/date"
android:text="@string/Exercise"
android:onClick="toStat"
/>
<Button
android:id="@+id/summary"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/date"
android:layout_toRightOf="@id/exercise"
android:text="@string/Summary"
android:onClick="toTraining"
/>
<LinearLayout 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:background="@color/blue">
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
/>
</LinearLayout>
</RelativeLayout>
Its because you have not mentioned the linearlayout should be below the summary button. Hence its just overlapping the textview and buttons. Just add android:layout_below="@id/summary"
in the LinearLayout. Also mention the linear layout height as wrap_content.
<LinearLayout
android:layout_below="@id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blue">
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
/>
</LinearLayout>