Mark Pazon
Mark Pazon

Reputation: 6205

Unable to set Single Line on Support library EditTextPreference

I am currently using the support library version of EditTextPreference and I am unable to make the edit text dialog to be single line. Below is my code taken from settings.xml:

<EditTextPreference
        android:key="@string/settings_extra_remarks_key"
        android:maxLength="@integer/free_text_maxlength"
        android:inputType="text"
        android:maxLines="1"
        android:singleLine="true"
        android:imeOptions="actionDone"
        android:title="@string/settings_extra_remarks_title" />

As you can see I even added imeOptions="actionDone" to force the keyboard to not show an ENTER key but even the imeOptions does not work.

Help.

Upvotes: 3

Views: 621

Answers (2)

Gergely Kőr&#246;ssy
Gergely Kőr&#246;ssy

Reputation: 6393

This is an old question, so here's a brief answer.

The bugfix I created (https://github.com/Gericop/Android-Support-Preference-V7-Fix) now (and has for a while) forwards the attributes set on EditTextPreference to the EditText in the dialog. Also, if you import the EditTextPreference from com.takisoft.fix.support.v7.preference package instead of the official one, you'll have access to the EditText by calling getEditText() on the EditTextPreference.

I wish Google fixed the problems, but it seems like they don't really care...

Upvotes: 1

bapho
bapho

Reputation: 936

EDIT:

there's a bugifx on github: https://github.com/Gericop/Android-Support-Preference-V7-Fix

"So, Google gives us a solution which I think is not ideal but works. According to this, instead of using

<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>

one should use"

<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>

Upvotes: 0

Related Questions