views:

181

answers:

2

I would like to create a UI where half of the screen is a ListView and the bottom half is another view. Not sure how to specify the maximum height for the ListView.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" android:text="Hello StockTwits!"/>


<ListView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ListView"></ListView><ViewFlipper android:id="@+id/ViewFlipper" android:layout_width="fill_parent" android:layout_height="fill_parent"><LinearLayout android:id="@+id/LinearLayoutST" android:layout_height="fill_parent" android:layout_width="fill_parent"><ImageView android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/icon"></ImageView>
</LinearLayout>
<LinearLayout android:id="@+id/LinearLayoutChart" android:layout_height="fill_parent" android:layout_width="fill_parent">

<TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="View 2"></TextView>
</LinearLayout>
<LinearLayout android:id="@+id/LinearLayoutDetails" android:layout_height="fill_parent" android:layout_width="fill_parent">
<TextView android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="View 3"></TextView>
</LinearLayout>
</ViewFlipper>



</LinearLayout>
A: 

You could set the weight of both elements to 1. This will cause them to take up the same amount of space on the screen, provided niether needs to be larger than half.

Mayra
A: 

solved by setting max height to 200dp

Sheehan Alam