How to show * again for required fields in action

I have a requirement to display the * symbol in relation to required fields in Activity. Can you suggest how I can do this. Any help would be appreciated.

+7
source share
4 answers

I would say that * as a marker for the required field does not follow the native Android theme. The combination of setHint and setError would look more natural for an Android app.

+7
source

Just grab a Relative Layout and on the right side of the EditText set ImageView with an * image source like this,

enter image description here

 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <EditText android:id="@+id/edit_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dip" android:text="Hello World" /> <ImageView android:layout_toRightOf="@id/edit_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@id/edit_text" android:src="@drawable/star"/> </RelativeLayout> 

Output:

enter image description here

+3
source

The following should work:

 <TextView android:id="@+id/date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="verdana" android:text="FirstName" android:textColor="#000" android:drawableRight="@drawable/star" /> <EditText android:id="@+id/editTextFirstName" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_weight="1" android:hint="FirstName" /> 
0
source

Why not try something like below

 txt.setText(Html.fromHtml("mm<sup>2</sup>")); 
0
source

All Articles