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. Detect OSK shown / hidden events

Hi all!

We're trying to trigger an animation whenever the on screen keyboard
is shown or closed. There doesn't seem to be any options to register
listeners directly to that event either in the EditText or in the
window / app in general. Only solution I managed to find was an older
post here where solution was to listen to size changed events.

2. tabbed InfoWindow

I would like to know how to make this application.

when the user selects a location it appears 'tabbed InfoWindow'
containing the information.



3. Subclass to save global state?

4. Android WebView

5. Help me about publish fee

6. [WTI] komik 3D

7. "Failed to find provider info for" ContentProvider