To some extent ...
here are my findings
Html/Spannable
the Floating
text TextInputEditText
does not work.
txt_usemail.setHint(Html.fromHtml("<font color=\"#707E90\">" + "Companyname" + "</font>" + "<font color=\"#FF0000\">" + "*" + "</font>"));
Html/Spannable
on TextInputLayout
hint does not work.
txt_usemail.setHint(Html.fromHtml("<font color=\"#707E90\">" + "Companyname" + "</font>" + "<font color=\"#FF0000\">" + "*" + "</font>"));
Html/Spannable
on TextInputEditText
works.
et_usemaill.setHint(Html.fromHtml("<font color=\"#707E90\">" + "Companyname" + "</font>" + "<font color=\"#FF0000\">" + "*" + "</font>"));
, setHint()
TextInputEditText
(, 3), Floating
.
Floating
, setHint()
TextInputLayout
EditText
/
final TextInputLayout txt_usemail = findViewById(R.id.txt_usemail);
final TextInputEditText et_usemaill = findViewById(R.id.et_usemaill);
et_usemaill.setHint(Html.fromHtml("<font color=\"#707E90\">" + "Companyname" + "</font>" + "<font color=\"#FF0000\">" + "*" + "</font>"));
et_usemaill.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (et_usemaill.getText().toString().equals("")) {
if (hasFocus) {
et_usemaill.setHint(null);
txt_usemail.setHint(Html.fromHtml("<font color=\"#c5c5c5\">" + "Companyname" + "</font>" + "<font color=\"#FF0000\">" + "*" + "</font>"));
} else {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
txt_usemail.setHint(null);
et_usemaill.setHint(Html.fromHtml("<font color=\"#707E90\">" + "Companyname" + "</font>" + "<font color=\"#FF0000\">" + "*" + "</font>"));
}
}, 200);
}
}
}
});
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">#c5c5c5</item>
<item name="colorControlActivated">#c5c5c5</item>
<item name="colorControlHighlight">#c5c5c5</item>
</style>
<style name="TextAppearence.App.TextInputLayout" parent="@android:style/TextAppearance">
<item name="android:textColor">@android:color/holo_red_dark</item>
<item name="android:textSize">12sp</item>
</style>
<android.support.design.widget.TextInputLayout
android:layout_marginTop="56dp"
android:id="@+id/txt_usemail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"
android:textColorHint="@android:color/holo_red_dark"
>
<android.support.design.widget.TextInputEditText
android:id="@+id/et_usemaill"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:inputType="textEmailAddress"
android:textColor="@color/white" />
</android.support.design.widget.TextInputLayout>
-