Question

I replicated the ListPreference code into my own custom ListPreference and created an ArrayAdapter<> for the list, which inflates simple_list_item_single_choice in getView()
But I get a list with short rows, as opposed to the original ListPreferences which has taller rows.

Am I using the wrong layout resource?

Was it helpful?

Solution 2

I found out what the default layout is for ListPreference.

android.R.layout.select_dialog_singlechoice

I always forget that the source code I cannot see in Eclipse is always available at the GrepCode site
I traced the source code for AlertParams in AlertController and there I found what the dialog.mSingleChoiceItemLayout field was.

OTHER TIPS

A solution could be to create your own layout for each cell from simple_list_item_single_choice layout, specifying a padding (top and bottom) in the parent container so that you have a taller cell. Obviously you would have to update in your adapter the reference to the layout you want to use for the cell.

You can view the source code of Android directly in Eclipse. Here you have a nice tutorial on how to do it ;)

Attaching Android platform source in Eclipse

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top