I have this layout file as my main activity’s layout. when I don’t have the linear layout and the two textview in the middle, the list view worked. however, when i have them in the file, the view wont show the listview content. Can anyone tell whats the problem?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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="horizontal">
<TextView
android:id="@+id/today_header"
android:layout_width="fill_parent"
android:layout_weight="2"
android:layout_height="70dip"
android:textColor="#dc6800"
android:textSize = "20sp"
android:paddingTop="12dip"
android:paddingLeft="10dip"
>
</TextView>
<TextView
android:id="@+id/today_total"
android:layout_width="fill_parent"
android:layout_weight="3"
android:layout_height="70dip"
android:textSize = "6sp"
android:textColor="#4A4A4A"
android:paddingTop="20dip"
android:paddingRight="25dip"
android:textStyle="bold"
/>
</LinearLayout>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
It is because the LinearLayout is set to
android:layout_height="fill_parent"and the TextViews, well they take up the whole screeen because you set weights to them, so the actuall height of the TextViews does not get applied.
Change it to: