[JAVA] How to prevent editTextPreference of android PreferenceFragmentCompat from breaking

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.

スクリーンショット 2019-04-11 14.24.58.png

I can't break a line! It was good!

Recommended Posts

How to prevent editTextPreference of android PreferenceFragmentCompat from breaking
How to write Scala from the perspective of Java
[Android] How to get the setting language of the terminal
How to migrate from JUnit4 to JUnit5
Java to fly data from Android to ROS of Jetson Nano
How to get the longest information from Twitter as of 12/12/2016
How to Burning a Install Disk of Windows from Ubuntu
How to implement one-line display of TextView in Android development
How to prevent past dates from being entered in Rails forms
How to push from Tarminal to GitHub
How to "hollow" View on Android
[Rails] How to prevent screen transition
Android: How to deal with "Could not determine java version from '10 .0.1'"
How to use setDefaultCloseOperation () of JFrame
From introduction to use of ActiveHash
From introduction to usage of byebug
[Android] How to make Dialog Fragment
How to get coverage of Android Instrumented Tests [Do your best]
How to change from HTML to Haml
[With explanation of why to do it] How to prevent others from editing with Rails' CRUD app with authentication function
Android development, how to check null in the value of JSON object
From pulling docker-image of rails to launching
How to prevent duplicate processing by addEventListener
[Rails] How to convert from erb to haml
How to name variables 7 selections of discomfort
[Android] How to deal with dark themes
How to detect microphone conflicts on Android
[java] Summary of how to handle char
[IOS] How to get data from DynamoDB
How to call Swift 5.3 code from Objective-C
How to determine the number of parallels
[Flutter] How to use C / C ++ from Dart?
[Java] [Maven3] Summary of how to use Maven3
Java: How to send values from Servlet to Servlet
How to sort the List of SelectItem
How to use ExpandableListView in Android Studio
[Android 9.0 Pie] Example of how to call strings.xml other than Activity and Fragment
How to get an arbitrary digit from a number of 2 or more digits! !!
Summary of how to select elements in Selenium
JDBC promises and examples of how to write
How to find the cause of the Ruby error
[Ruby] How to convert from lowercase to uppercase and from uppercase to lowercase
[Rails] Introduction of pry-rails ~ How to debug binding.pry
Summary of how to create JSF self-made tags
POST images from Android to PHP using Retrofit
Customize how to divide the contents of Recyclerview
How to link Rails6 Vue (from environment construction)
[Bcrypt] how to cancel presence: true of has_secure_password
How to get a heapdump from a Docker container
[Java] Summary of how to abbreviate lambda expressions
How to dump from database (DB) to seeds file
[Android] How to detect volume change (= volume button press)
How to prevent direct URL typing in Rails
How to get Class from Element in Java
How to get today's day of the week
From setup to usage of Selenium wrapper Selenide
Output of how to use the slice method
How to make Unity Native Plugin (Android version)
How to use enum (introduction of Japanese notation)
[Swift UI] How to disable ScrollsToTop of ScrollView
[Java] How to switch from open jdk to oracle jdk