ListView in custom preference

by Eric Crump » Wed, 19 Jan 2011 11:01:59 GMT

Sponsored Links
 I need to put a ListView in a custom preference.  It needs to look
similiar to the WiFi settings in the OS preferences.  My problem is I
am unable to make it take fill the space.  It only takes up the space
given to a normal preferece item.  How do I make the LinearLayout I
return from onCreateView take up the remainder of the height?

protected View onCreateView(ViewGroup parent){

        LinearLayout layout = new LinearLayout(getContext());

        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(


        list = new ListView(getContext());


        adapter = new ArrayAdapter<String>(getContext(),
android.R.layout.simple_list_item_1, new String[]{"abc", "def"});

        return layout;

Sorry for a repost.  My original post seems to have disappeared.


Re: ListView in custom preference

by kavitha b » Thu, 20 Jan 2011 04:40:12 GMT

 Use Custom List View Item extending Base Adapter


Sponsored Links

Other Threads

1. X10 Interface


Besok X10 launch di Spore, tadi lihat interface timescape dan mediascape
nya. amazing.
Kapan ya ada rom X10 untuk N1? *ngimpi*

sekarang cukup puas dengan desire rom dulu deh.


"Indonesian Android Community [id-android]" 

2. SlideScreen


Kalo ada yg punya, tp yg Pro :) , japri dong :D

Thx yah

Jus* ^ owner white dream ^
~ send using pc jangkrik krik krik ~
$ $

"Indonesian Android Community [id-android]"

3. Parent View intercepts events on Child View

4. i-Mobile IE 6010

5. FYI : Astro update

6. Pejing AJ

7. Calander