当 numeric=“integer”时不显示提示在编辑文本中
标题就是问题。
有人知道有什么解决办法吗?
请帮我。
谢富尔
The title is the question.
Anybody know any solution?
Please help me.
Shaiful
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
XML 属性 android:numeric 不是布尔值,“true”不是有效参数,它必须是“整数”、“有符号”、“小数”中的一个或多个。
根据您发布的示例,您的问题是由于选择添加重力以使文本居中。 SDK 中存在一个已知错误,从 2.3 开始,看来还是没有解决。当
android:singleLine
和android:gravity
的任何自定义值设置在一起时,此错误会隐藏提示文本。此时此刻,您的选择实际上是删除其中一个。一些解决方法选项:android:gravity
声明并使文本左对齐。android:gravity
,并设置layout_width="wrap_content"
。然后将整个小部件在父布局中适当居中。对于标准EditText
背景来说,这可能看起来有点愚蠢,因为它会增大和缩小。您可能必须将其设置为 null 并使背景成为父容器的一部分。另外,别忘了给这个错误加注星标:)
干杯。
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".
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 ofandroid:gravity
are set together. Your choice at this juncture really is to remove one or the other. Some workaround options:android:gravity
declaration and have the text left-aligned.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.Also, don't forget to star the bug :)
Cheers.
我认为您应该使用此处指定的属性之一对于数字属性。不确定它是否解决了问题,但您应该使用其中一个值,因为它指出:“必须是以下常量值中的一个或多个(用“|”分隔)。”
I think you should use one of the attributes specified here for the numeric attribute. Not sure if it solves the problem but you should use one of those values as it states: "Must be one or more (separated by '|') of the following constant values."
我自己也在为这个问题而苦苦挣扎,我在这里找到的所有帖子都无法帮助我。
然后,当我再次摆弄 EditText 时,我发现当 android:inputType 与 android:ellipsize 组合分配时,提示确实会显示。
后来的搜索指向相同的方向:http://code.google。 com/p/android/issues/detail?id=7252
这仍然是一个奇怪的问题,应该已经解决了......
I was struggling with this issue myself and none of the posts I found here could help me out.
Then when I was fiddeling with the EditText again, I found out that the hint does show when an android:inputType was assigned in combination with android:ellipsize.
A later search pointed into the same direction: http://code.google.com/p/android/issues/detail?id=7252
Still it's a weird issue, which should already be fixed...