It didn't come out even after checking it, so Since a line break was created in EditTextPreference, the operability was a little bad. This is a method to prevent line breaks.
Rather, it is a method to specify the layout of EditText called in Dialog.
preferences.xml
<EditTextPreference
      android:dialogLayout="@xml/prefernce_custom_edittext"
      android:key="userName"
      android:title="username" />
Set android: dialogLayout.
prefernce_custom_edittext.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <EditText
        android:id="@android:id/edit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="18dp"
        android:paddingRight="18dp"
        android:inputType="text|textNoSuggestions" />
</LinearLayout>
Now you can customize it as you normally would.
I can't break a line! It was good!
Recommended Posts