Using a LinearLayout.LayoutParams should definitely work, since your ListView *is* inside of a LinearLayout:

http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html#attr_android:layout_weight

As for the null pointer exception, have you tried "addView (View child, ViewGroup.LayoutParams params)" ?

BTW, Settings app uses a PreferenceCategory for the network list, with each network being a Preference, so all layout issues are already handled by the preference framework.

-- Kostya

19.01.2011 16:41, Eric Crump пишет:
I can't set the Layout weight. I'm doing it all in Java code and if I set the weight directly I get a null exception. If I create new LayoutParams I get a class cast exception. I've tried LinearLayout.LayoutParams, FrameLayout.LayoutParams, etc and I get the exception. I did try to set the height manually to see what happens. If I set it to something like 300 instead of fill_parent it does display a larger control, however, it no longer scrolls.
--
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


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
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