I created a small Android app containing only one activity. In it I put two EditText components. I want to set placeholders in them, as in HTML5 inputs, but I can not find a solution.
I created a small Android app containing only one activity. In it I put two EditText components. I want to set placeholders in them, as in HTML5 inputs, but I can not find a solution.
I discovered the solution!
In Android Studio, the EditText does not have the placeholder property, but the android: hint property exists. And with that I also discovered the android: textColorHint property that changes the color of the text in question.
See below for my example.
<EditText
android:id="@+id/edtAltura"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15sp"
android:hint="Ex.: 1.82"
android:textColorHint="#bbb"
android:inputType="numberDecimal" />
Result
Go to EditText properties and search for Hint. It works as a placeholder.