setting max height of listview with initial height is wrap content(it may be empty)

by jalandar » Tue, 13 Jan 2009 20:50:32 GMT


Sponsored Links
 Hello everybody I want set initial height of list view with wrap
content, and later it will be expanded as per data added to specific
limit of height. I used wrap_content for height and android:maxHeight
="100px", but it is not working properly the list grows in height
beyond the maxHeight as the list item added.
Is there any other solution.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Need help working with xml layout

I have a List and am providing a specific view for each row.  All java
functionality is workign fine, it's the layout of the view elements
that is giving me trouble.  I
This is the layout I'm trying to achieve (how to show in text
message?):
Image -> Text(name)/Text(Price) -> Button - CheckBox

where Image is on the left, next the 2 text fields are stacked on each
other and centered, then the Button and Checkbox are right-justified.

Here is the xml I have right now ...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:layout_width="fill_parent"
android:layout_height="fill_parent"
        android:orientation="horizontal">
        <ImageView android:id="@+id/offerImage" android:layout_width="80sp"
                android:layout_height="80sp" android:layout_margin="5sp" />
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                android:layout_width="wrap_content"
android:layout_height="fill_parent"
                android:orientation="vertical"
android:layout_gravity="center_vertical">
                <TextView android:id="@+id/productName" 
android:layout_width="100sp"
                        android:layout_height="wrap_content"
                        android:textSize="14sp" 
android:textColor="@color/screen_black"
                        android:layout_gravity="center_vertical"/>
                <TextView android:id="@+id/price"
android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
        </LinearLayout>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                android:layout_width="fill_parent"
android:layout_height="fill_parent"
                android:layout_gravity="right"
                android:orientation="horizontal"
                >
                <Button android:id="@+id/buy" 
android:layout_height="wrap_content"
                        android:layout_width="80sp" android:autoText="true"
android:text="Preorder"
                        android:layout_gravity="center_vertical|right"
                />
                <CheckBox android:id="@+id/favorite" 
style="?android:attr/starStyle"
                        android:layout_width="wrap_content"
android:layout_height="wrap_content"
                        android:layout_marginLeft="5sp"
android:layout_gravity="center_vertical|right"/>
        </LinearLayout>
</LinearLayout>

The overall layout seems to be working, looking at the Hierarchy
Viewer, the Linear Layouts I use for the TextViews and the Button/
CheckBox are laid out correctly and occupying the correct space.
however, the TextViews in teh first layout are pinned to the upper-
right corner of the layout, they should be centered.
And the button and checkbox are centered fine, but the are pinned to
the left edge of teh layout and I want then pinned to the right edge
instead.

Does anyone know how i can accomplish this?

Related, when specifying a button, is there a way to just have the
button dynamically size to whatever text is holds?

Thanks!
--~--~---------~--~----~------------~-------~--~----~

2. can not find http proxy support for opencore http streaming playback

http streaming playback can be support by opencore. but no any api for
this in mediaplayer. can android developers add this functionality? i
have no idea whether they can see my post.


--~--~---------~--~----~------------~-------~--~----~

3. Setting a layout object style and gravity in code.

4. Proper Intent for an image/jpeg picture when using addIntentOptions?

5. Eclipse build eats memory then dies

6. Negative culture of Android Market reviews

7. Changes not affecting layout?