How make android edittext hint center and left cursor -
how set hint text in center of edittext , set cursor in left part of edittext? , when start input text start center edittext?
now have
<linearlayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="@drawable/line_white" android:layout_marginbottom="25dp" android:paddingbottom="16dp" android:gravity="center_horizontal"> <edittext android:id="@+id/loginemailfield" android:layout_width="match_parent" android:layout_height="wrap_content" android:autotext="false" android:ems="10" android:hint="choose email adress" android:inputtype="textemailaddress" android:paddingleft="2dp" android:singleline="false" android:textcolor="#ffffff" android:textcolorhint="#9377ab" android:textsize="19sp" android:textstyle="bold" android:background="#00000000" android:layout_marginright="2dp" android:gravity="center"/> </linearlayout>
place following in code once inflated view:
edittext edittext = (edittext)findviewbyid(r.id.loginemailfield); edittext.setselection(0);
it place caret @ beginning of hint text. once start typing text keep being centered , caret move @ end of you're typing.
Comments
Post a Comment