提示不显示数字时= QUOT;整数QUOT;在的EditText [英] Hint Not Displaying When numeric="integer" in EditText
问题描述
标题是问题。
有人知道任何解决方案?
Anybody know any solution?
请帮我。
Shaiful
推荐答案
XML特性的Android版本:数字不是一个布尔值,真是不是一个有效参数,它必须是一个或多个整的,签字,小数。
The XML attribute android:numeric is not a boolean value and "true" is not a valid parameter, it must be one ore more of "integer", "signed", "decimal".
每您发布样本,您的问题是由于增加重力居中文本的选择。有一个在SDK中已知的bug ,截至2.3,它看起来仍然不是固定的。这个bug隐藏提示文本时的android:SINGLELINE
和的任何自定义值安卓重力
设置在一起。你的选择在这个时刻真的是删除一个或另一个。一些解决方法选择:
Per the sample you've posted, your issue is due to the choice of adding gravity to center the text. There is a known bug in the SDK that, as of 2.3, it looks like is still not fixed. This bug hides the hint text when android:singleLine
and any custom value of android:gravity
are set together. Your choice at this juncture really is to remove one or the other. Some workaround options:
- 删除
的android:重力
声明,并具有文本左对齐 - 保留声明,并删除机器人:单线。在这种情况下,你可能会重写编辑操作,以获得软键盘上的默认下一步或完成按钮。
- 删除
安卓重力
,并设定layout_width =WRAP_CONTENT
。然后适当地居中在父布局的整个部件。这可能看起来有点傻傻的标准的EditText
的背景,因为这将增大和缩小。您可能需要将其设置为空,使父容器的背景部分。
- Remove the
android:gravity
declaration and have the text left-aligned. - Keep the declaration and remove android:singleLine. In this case, you will probably have to override the Editor Action in order to get the default Next or Done button on the soft keypad.
- Remove
android:gravity
, and setlayout_width="wrap_content"
. Then appropriately center the entire widget in the parent layout. This may look a little goofy with the standardEditText
background as it will grow and shrink. You may have to set this to null and make the background part of a parent container.
另外,不要忘了明星的bug:)
Also, don't forget to star the bug :)
干杯。
这篇关于提示不显示数字时= QUOT;整数QUOT;在的EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!