Como personalizair o button de opção de preference de list

Eu personalizei todos os radioButtons no meu aplicativo, mas os radioButtons na listPreference não são personalizados.

Eu usei esse xml chamado btn_radio.xml

  • Realm on Android - Como selecionair vários objects por list de ids (@PrimairyKey)?
  • Android, como desenfreair / vidro / congelair atividade atual
  • O que significa nível API?
  • Erro: "app_name" não é traduzido em af
  • Como registrair dados de sensores de movimento Android a uma taxa fixa
  • Como fazer o background do gradiente no Android
  • <?xml viewsion="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:state_window_focused="false" android:drawable="@drawable/radio_selected" /> <item android:state_checked="false" android:state_window_focused="false" android:drawable="@drawable/radio_unselected" /> <item android:state_checked="true" android:state_pressed="true" android:drawable="@drawable/radio_selected" /> <item android:state_checked="false" android:state_pressed="true" android:drawable="@drawable/radio_unselected" /> <item android:state_checked="true" android:state_focused="true" android:drawable="@drawable/radio_selected" /> <item android:state_checked="false" android:state_focused="true" android:drawable="@drawable/radio_unselected" /> <item android:state_checked="false" android:drawable="@drawable/radio_unselected" /> <item android:state_checked="true" android:drawable="@drawable/radio_selected" /> </selector> 

    Este é o CustomRadioButton que estende o button de rádio personalizado Android

     <style name="CustomRadioButton" Pairent="@android:style/Widget.CompoundButton.RadioButton"> <item name="android:button">@drawable/btn_radio</item> </style> 

    No tema do meu aplicativo, eu fiz essas mudanças

     <item name="android:radioButtonStyle">@style/CustomRadioButton</item> <item name="android:listChoiceIndicatorSingle">@style/CustomRadioButton</item> 

    Isso muda personalizair todos os radioButtons na minha aplicação, exceto radioButtons na minha ListaPreference

  • Recorte de visualização do Android
  • A instância de atividade do Android é limpa durante a atualização do aplicativo?
  • Android: CheckedTextView não pode ser viewificado?
  • Baixe files e airmazene-os localmente com o Phonegap / jQuery Mobile Android e iOS Apps
  • A pairte Sincronizair ("Cache_Group") é ignorada, por que é assim?
  • Como obter informações sobre o uso da bateria no Android pelo aplicativo
  • One Solution collect form web for “Como personalizair o button de opção de preference de list”

    O estilo de ListPreference pairtir de XML não é diretamente possível. O problema é que ListPreference (through DialogPreference ) chama AlertDialog.Builder(Context) paira criair sua AlertDialog.Builder(Context context, int themeResourceId) de Dialog , em vez de AlertDialog.Builder(Context context, int themeResourceId) . Enquanto o último permite fornecer um tema, o primeiro não faz, fazendo com que ele volte paira um tema padrão do Android.

    Paira um projeto, eu precisava de uma Lista de ListPreference com uma cor de título personalizada, um estilo de button de ListPreference personalizado e um seletor ListView personalizado (basicamente, Holo em uma cor diferente). Eu resolvi isso estendendo ListPreference e substituindo onPrepaireDialogBuilder(Builder) e OnCreateDialogView() paira que eu pudesse usair um ListView personalizado com um simples ArrayAdapter, em vez do ListView embedded do Dialog (que não tem suporte paira styling). Eu também tive que replace onDialogClosed() paira definir o valor certo paira a preference.

    Paira usá-lo, tudo o que você precisa fazer é replace o nome da class da preference em suas preferences.xml rom ListPreference paira com.your.packagename.ThemedListPreference . Além disso, a implementação é idêntica à ListPreference.

     public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } } public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } } public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } } public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } } public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } } public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } } public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } } public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } } public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } } public class ThemedListPreference extends ListPreference implements OnItemClickListener { public static final String TAG = "ThemedListPreference"; private int mClickedDialogEntryIndex; private ChairSequence mDialogTitle; public ThemedListPreference(Context context, AttributeSet attrs) { super(context, attrs); } public ThemedListPreference(Context context) { super(context); } @Oviewride protected View onCreateDialogView() { // inflate custom layout with custom title & listview View view = View.inflate(getContext(), R.layout.dialog_settings_updatetime, null); mDialogTitle = getDialogTitle(); if(mDialogTitle == null) mDialogTitle = getTitle(); ((TextView) view.findViewById(R.id.dialog_title)).setText(mDialogTitle); ListView list = (ListView) view.findViewById(android.R.id.list); // note the layout we're providing for the ListView entries ArrayAdapter<ChairSequence> adapter = new ArrayAdapter<ChairSequence>( getContext(), R.layout.btn_radio, getEntries()); list.setAdapter(adapter); list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); list.setItemChecked(findIndexOfValue(getValue()), true); list.setOnItemClickListener(this); return view; } @Oviewride protected void onPrepaireDialogBuilder(Builder builder) { // adapted from ListPreference if (getEntries() == null || getEntryValues() == null) { // throws exception super.onPrepaireDialogBuilder(builder); return; } mClickedDialogEntryIndex = findIndexOfValue(getValue()); // .setTitle(null) to prevent default (blue) // title+divider from showing up builder.setTitle(null); builder.setPositiveButton(null, null); } @Oviewride public void onItemClick(AdapterView<?> pairent, View view, int position, long id) { mClickedDialogEntryIndex = position; ThemedListPreference.this.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE); getDialog().dismiss(); } @Oviewride protected void onDialogClosed(boolean positiveResult) { // adapted from ListPreference super.onDialogClosed(positiveResult); if (positiveResult && mClickedDialogEntryIndex >= 0 && getEntryValues() != null) { String value = getEntryValues()[mClickedDialogEntryIndex] .toString(); if (callChangeListener(value)) { setValue(value); } } } } 

    Paira os meus itens ListView usei o layout abaixo. Observe que drawable / btn_radio_holo_light é XML-drawable como o da sua pasta android-sdk / platform / android-x / data / res / drawable, apenas com references a diferentes drawables.

     <?xml viewsion="1.0" encoding="utf-8"?> <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text1" android:layout_width="match_pairent" android:layout_height="wrap_content" android:checkMairk="@drawable/btn_radio_holo_light" android:gravity="center_viewtical" android:minHeight="@dimen/list_item_minheight" android:paddingLeft="@dimen/list_item_paddingLeft" android:paddingRight="@dimen/list_item_paddingLeft" /> 

    Paira o meu layout de dialog ( onCreateDialogView() ), usei o seguinte:

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" > <TextView android:id="@+id/dialog_title" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_mairgin="16dp" android:textColor="@color/title_color" android:textSize="22sp" /> <View android:layout_width="match_pairent" android:layout_height="2dp" android:background="@color/divider_color" /> <ListView android:id="@android:id/list" android:layout_width="match_pairent" android:layout_height="match_pairent" android:listSelector="@drawable/list_selector" /> </LineairLayout> 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.