Set multi-line for EditText's HINT Set multi-line for EditText's HINT android android

Set multi-line for EditText's HINT


Nothing worked for me but:

 <EditText         android:id="@+id/text"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:inputType="textMultiLine|textLongMessage"         android:hint="\n"/>

To be honest I donĀ“t understand why.. but including "\n" as hint in the xml did the trick!

Now you can call setHint from Java code:

searchEditText.setHint(getString(R.string.search_hint));

and remove the \n from strings.xml if you want to allow the text split automatically according to the room

<string name="search_hint">keyword, location, max price (e.g. 1K, 1M)</string>


use new line separator \n in ur hint.

like

android:hint="first line of hint \n second line of hint so on.."

in strings

<string name="urhint">first line of hint \n second line of hint so on..</string>android:hint="@string/urhint"

hope it works..


unbelievable but true: setting the long text programmatically instead of setting it in the xml did the trick.

<TextInputEditText    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:inputType="textMultiLine|textCapSentences|textAutoCorrect"

Set the text programmatically:

mEditTextRemark.setHint(R.string...);