I have a simple sign in activity
in my app with email and password fields. There is a strange problem with the hint
and cursor
position in the email EditText
:
As can be seen in the image, by default, the cursor
isn't at the first position. It is shown after the hint (as if the hint
is an input text)
As far as the layout
goes, the password EditText
is the same as the email one, but it doesn't have this problem:
Anyone has any clue why this happens? And how can I solve it?
Here's the activity's layout:
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
style="@style/LoginFormContainer"
android:orientation="vertical" >
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:hint="@string/prompt_email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:hint="@string/prompt_password"
android:imeActionId="@+id/login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dip"
android:gravity="center" >
<!-- sign in button -->
<TextView
android:gravity="center"
android:id="@+id/sign_in_button"
android:layout_width="120dip"
android:layout_height="50dip"
android:layout_alignParentRight="true"
android:layout_marginLeft="25dip"
android:layout_marginRight="20dip"
android:background="@drawable/btn_background_login_and_offered_and_followers"
android:clickable="true"
android:onClick="signInButton"
android:text="@string/action_sign_in_register" />
<!-- sign up button -->
<TextView
android:gravity="center"
android:id="@+id/sign_up_button"
android:layout_width="120dip"
android:layout_height="50dip"
android:layout_marginLeft="20dip"
android:layout_toLeftOf="@id/sign_in_button"
android:background="@color/Gray"
android:onClick="signUpButton"
android:text="@string/action_sign_up_register" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
If any other code part is needed, please tell me to add it.
Try this code:
android:textCursorDrawable="@null"
It works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With