在 Android 中,我使用单行编辑文本,并将重力设置为中心.在模拟器中,提示和闪烁的光标都显示出来了.在设备 (Xperia X10) 上进行测试时,提示文本和闪烁的光标都不会出现.只有当我在编辑文本中输入一些文本时才会显示闪烁的光标.
In Android I'm using a single line edittext with gravity set to center. In the Emulator this works great both the hint and a blinking cursor shows up. When testing on device (Xperia X10) neither the hint text nor the blinking cursor shows up. The blinking cursor only shows if I enter some text into the edittext.
这是我的编辑文本,谁能看看有没有遗漏?
This is my edittext, can anyone see if something is missing?
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ellipsize="end"
android:maxLines="1"
android:gravity="center"
android:layout_gravity="center"
android:hint="Some hint text"
></EditText>
</LinearLayout>
我想要什么:
我用上面的代码得到了什么(没有光标的空编辑文本):
What I get with the above code (empty edittext with no cursor):
我终于找到了让它工作的解决方案.这个 EditText 对我有用:(在 Sony Ericsson X10 和 HTC Wildfire 上测试)
I finally found the solution to get it working. This EditText works for me: (Tested on Sony Ericsson X10 and HTC Wildfire)
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:digits="0123456789.,"
android:ellipsize="start"
android:maxLines="1"
android:gravity="center"
android:hint="Some hint text"
></EditText>
这篇关于Android:重心的Edittext在设备上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在android中剪切、复制、粘贴Cut, copy, paste in android(在android中剪切、复制、粘贴)
android EditText 融入背景android EditText blends into background(android EditText 融入背景)
更改 EditText 的线条颜色 - AndroidChange Line Color of EditText - Android(更改 EditText 的线条颜色 - Android)
EditText 始终显示带 2 位小数的数字EditText showing numbers with 2 decimals at all times(EditText 始终显示带 2 位小数的数字)
更改光标在展开的 EditText 中的开始位置Changing where cursor starts in an expanded EditText(更改光标在展开的 EditText 中的开始位置)
android中的EditText,adjustPan,ScrollView问题EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView问题)