Prompt please where it is possible to read about creating a custom layout listpreference ( background and layout top panel, panel button ). Met - examples only for custom ro
in your preference xml file
CustomListPreference.java
class CustomListPreference extends ListPreference {
mListAdapter = new your_custom_list_adapter();
private int mClickedDialogEntryIndex;
public CustomListPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomListPreference(Context context) {
super(context);
}
@Override
protected void onPrepareDialogBuilder(Builder builder) {
mClickedDialogEntryIndex = findIndexOfValue(getValue());
builder.setSingleChoiceItems(mListAdapter, mClickedDialogEntryIndex,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
if (mClickedDialogEntryIndex != which) {
mClickedDialogEntryIndex = which;
CustomListPreference.this.notifyChanged();
}
CustomListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
dialog.dismiss();
}
});
builder.setPositiveButton(null, null);
}
@Override
protected void onDialogClosed(boolean positiveResult) {
CharSequence[] entryValues = getEntryValues();
if (positiveResult && mClickedDialogEntryIndex >= 0 && entryValues != null) {
String value = entryValues[mClickedDialogEntryIndex].toString();
if (callChangeListener(value)) {
setValue(value);
}
}
}
}