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?

enter image description here

now have

enter image description here

<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

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -