嗨,我正在与包含登录屏幕的android应用程序。在我的登录屏幕中,我有用户名和密码edittext字段。在edittext中,我需要将提示作为“输入用户名”放在中心位置,所以我将重力设置为edittext字段的“center”,但现在问题是光标在中心位置也可见,我需要光标位于左侧。我也尝试了下面的编码。光标在android的中心位置
edtUserName.setSelection(1);
This is my xml code:
<EditText
android:id="@+id/edt_login_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_txt_field"
android:ellipsize="start"
android:focusableInTouchMode="true"
android:hint="Enter Username"
android:maxLines="1"
android:singleLine="true"
android:textStyle="italic"
android:typeface="serif" android:gravity="center">
</EditText>
Please help me to solve this problem. Thanks in advance.
提供XML文件Plz .. – Bhavin
您好我现在添加了xml代码,请刷新并找到代码 – Dhamodharan
您是否解决了这个问题? – Salmaan