ListView supports the WRAP_CONTENT height mode but it is really not
meant for that. First of all, having a ListView in WRAP_CONTENT is
very costly in terms of layout. It is also meaningless. What does
WRAP_CONTENT mean for a ListView since the goal of ListView is to
virtualize its children? Because of this, ListView just does not
support growing or shrinking when you modify its adapter.

You should simply use FILL_PARENT for your ListView. And you may find
the last divider ugly but *every* ListView in the system behaves that
way. Your WRAP_CONTENT ListView just looks different from the rest of
the system for absolutely no good reason.

Consistency matters.

On Wed, Apr 1, 2009 at 6:40 AM, Streets Of Boston
<flyingdutc...@gmail.com> wrote:
>
> If your list-view uses a (list-)adapter (or a subclass of this), did
> you try to call notifyDataSetInvalidated() on the adapter?
> This will cause your adapter's getView(int position, View convertView,
> ViewGroup parent) to be called again and you can handle your changed
> list-item in there.
>
> On Apr 1, 5:24 am, matthias <m.kaepp...@googlemail.com> wrote:
>> Well, I found a really ugly workaround. That workaround is based on my
>> observation that the problem described does only occur if the
>> ListView's layout height is set to WRAP_CONTENT. So, since I use a
>> custom list adapter, I now call listView.getLayoutParams().height =
>> LayoutParams.FILL_PARENT whenever a text view is about to be
>> expanded... the reason I do not statically set its height to
>> FILL_PARENT is because then it will draw line separators below the
>> last element, which looks ugly if it doesn't expand to the bottom of
>> the screen.
>>
>> It works... but, yuck!
> >
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to