Reputation: 4266
I want to have a TextView above my two ListViews. That's my xml code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:baselineAligned="false"
android:orientation="horizontal"
android:layout_height="match_parent"
android:layout_width="match_parent">
<TextView
android:id="@+id/statusBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test" />
<LinearLayout
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_width="match_parent"
>
<ListView
android:id="@+id/leftView"
android:layout_height="match_parent"
android:layout_width="match_parent">
</ListView>
</LinearLayout>
<LinearLayout
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_width="match_parent">
<ListView
android:id="@+id/rightView"
android:layout_height="match_parent"
android:layout_width="match_parent">
</ListView>
</LinearLayout>
</LinearLayout>
Everything worked well before I added the TextView. Now only the TextView is visible and the two ListViews aren't shown anymore.
Edit: I want to have the ListViews still next to each other (one left, the other right).
Upvotes: 1
Views: 83
Reputation: 157437
Change the orientation of the LinearLayout
to vertical
android:orientation="vertical"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:baselineAligned="false"
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_width="match_parent">
<TextView
android:id="@+id/statusBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test" />
<LinearLayout
android:orientation="horizontal"
android:layout_height="match_parent"
android:layout_width="match_parent">
<ListView
android:layout_weight="1"
android:id="@+id/rightView"
android:layout_height="match_parent"
android:layout_width="0dip">
</ListView>
<ListView
android:layout_weight="1"
android:id="@+id/leftView"
android:layout_height="match_parent"
android:layout_width="0dip">
</ListView>
</LinearLayout>
</LinearLayout>
Upvotes: 2