I want to customize my EditTextPreference, so i added a TextView in the left of my EditTextPreference.
Here is my code:
<EditTextPreference
   android:key="alert_planed_edittext_preference"
   android:title="@string/alert_planed_edittext_preference"
   android:summary="@string/alert_planed_summary_edittext_preference"
   android:dialogTitle="@string/alert_planed_dialog_title_edittext_preference" />
That's what i get in my application:

And i want to customize my EditTextPreference, that's what i want to get:

I want to add the number in the right, can i do that?
When i click i get this dialog:

I want the user to be allowed to select only numbers, how can i do that?
Edit: I found the solution for the second problem:
<EditTextPreference
                android:key="alert_planed_edittext_preference"
                android:title="@string/alert_planed_edittext_preference"
                android:summary="@string/alert_planed_summary_edittext_preference"
                android:dialogTitle="@string/alert_planed_dialog_title_edittext_preference"
                android:numeric="integer" />
                For you second question, why you do not use a number picker instead of this edittext ?
Example (from android.dev)

and code like this :
Public class NumberPickerPreference extends DialogPreference {
    public NumberPickerPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        setDialogLayoutResource(R.layout.numberpicker_dialog);
        setPositiveButtonText(android.R.string.ok);
        setNegativeButtonText(android.R.string.cancel);
        setDialogIcon(null);
    }
    ...
}
Regarding your first question, i have to implement a customPreference. You can take example from IconPreferenceScreen which is in the settings menu.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With