安卓:EDITTEXT与重心不工作的设备 [英] Android: Edittext with gravity center not working on device

查看:105
本文介绍了安卓:EDITTEXT与重心不工作的设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android中,我使用的是单线的EditText重力设置为中心。在这个仿真器的伟大工程,都提示和闪烁的光标显示出来。当设备(Xperia X10的)测试既没有提示文本,也没有闪烁的光标显示出来。闪烁的光标只能说明,如果我输入一些文字到的EditText。

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.

这是我的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>

我想:

我得到上述code(无光标空的EditText):

What I get with the above code (empty edittext with no cursor):

推荐答案

我终于找到了解决方案,得到它的工作。这EditText上对我的作品:(测试索尼爱立信X10和HTC野火)

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>

这篇关于安卓:EDITTEXT与重心不工作的设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆