Hi,

It seems that the layout params you give your LinearLayout are not of
the right type. You need to use ListView.LayoutParams.

On Fri, Jun 19, 2009 at 6:52 AM, Bob.T.Terminal<[email protected]> wrote:
>
> When trying to add a header to a listview i keep on getting a
> java.lang.ClassCastException: android.widget.LinearLayout
> $LayoutParams. I thought it might be a problem with the widget i was
> adding to the header so i made the simple test case below which add
> just a colored linearlayout as the header and the problem still
> occurs. The rendering of the list with the adapter is working fine, i
> just cant add a header to it. Any help would be appreciated
>
> thanks
>
> _list = new ListView(this);
>
> LinearLayout ll = new LinearLayout(this);
> ll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 100));
> ll.setBackgroundColor(Color.RED);
> list.addHeaderView(ll);
>
> _list.setAdapter(_adapter);
>
> >
>



-- 
Romain Guy
Android framework engineer
[email protected]

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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to