我知道这个问题问了很多遍。但是没有一个例子对我有用。
我想通过XML文件设置光标在中心位置。
我怎样才能做到这一点??
我当前的光标位置显示在下图中。
我的XML文件代码如下
.XML文件
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/sigupDisplayName"
style="@style/editTextStyle"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/edittext_style"
android:ems="10"
android:gravity="center"
android:hint="@string/display_name" >
<requestFocus />
</EditText>
</LinearLayout>
我现在发现了主要问题
是什么...问题在API级别上。
我更改了程序的API级别。
在API 15以下,将光标设置在我的应用程序的中心。
从API 16开始,将光标位置设置为提示文本的开头...!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句