enter image description hereI want to set hint * in edittext in red color as a required field. Please give me suggestion
I want this star only in red color other as it is
enter image description hereI want to set hint * in edittext in red color as a required field. Please give me suggestion
I want this star only in red color other as it is
Store a string in strings file like this (if you want to make email required):
<string name="email">Email<font fgcolor="red">*</font></string>
and in your editText set hint like this:
android:hint="@string/email"
1. Add below string
in your strings.xml
for hints
.
<string name="hints"><![CDATA[Member ID(Don\'t include dash or space)<font color=\'#cc0029\'>*</font>]]></string>
2. Programmatically set this string
as hint
text from your Activity
class.
EditText editText = (EditText) findViewById(R.id.edit_member_id);
editText.setHint(Html.fromHtml(getString(R.string.hints)));
3. Here is your EditText
in XML:
<EditText
android:id="@+id/edit_member_id"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
OUTPUT:
Hope this will help~
You can simply do like below one
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Add text here (demo text)*"
android:textColorHint="@android:color/holo_red_dark"
/>