淡淡的EditText不显示 [英] EditText hint not displaying

查看:144
本文介绍了淡淡的EditText不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为新的Andr​​oid开发(C#开发OOP 10 +)我遇到了一个轻微的障碍(2.3.3)我不知道如何解决。我有一个< EditText上... /> 的有相互抵消的两个参数。

Being new to Android Development (c# OOP dev 10+) I ran into a slight snag (2.3.3) I don't know how to address. I have an <EditText.../> that has two parameters that cancel each other out.

我的意思是,作为一个Android用户我真的AP $ P $当人们使用标签如Android pciate:inputType下=numberDecimal为他们期望的数字输入字段。这样可以节省我从
不必翻转,从ABC到123键盘,而试图完成一个字段。但是问题来试图使用机器人时:提示=提示文字。 inputType下:如果字段已被确定为一个数字由 Android作为定义的提示文本将不会显示。

What I mean is that as an Android user I really appreciate when people use tags such as android:inputType="numberDecimal" for an input field where they expect numbers. This saves me from having to flip from ABC to 123 keyboard while trying to complete a field. However the problem comes in when trying to use the android:hint="Hint Text". The hint text won't display if the field has been determined to be a numeric as defined by the android:inputtype.

所以,我一直在寻找的投入就如何最好地解决此问题。我的想法是有上面的输入字段标签......作为应用程序的其余部分使用提示的,这将佼佼者。我可以放弃一个提示,但不是真的一样在该领域中有哪些信息,用户将失去一个好主意。我的第三个和最想到的是定义为inputType下然后文本处理onfocus事件和切换到数字。

So I was looking for input on how best to resolve this problem. My thoughts are have a label above the input field...this would standout as the rest of the app uses hint's. I could forgo a hint but not really a good idea as the user would be lost as to what info goes in the field. My third and best thought is to define the inputtype as text then handle the onFocus event and switch it to numeric.

任何其他建议表示欢迎。
JB

Any other suggestions welcome. JB

推荐答案

您没有提供任何code,使这更容易,所以在这里不基于我的回答一些快速阅读和研究为我用的Andr​​oid版本:暗示很多次我:

You did not provide any code to make this easier, so here is my answer based off some quick reading and research for I have used "android:hint" many times myself:

在这里,我相信你的问题已经被解决过,加入一定布局的元素的EditText,如机器人:重力=CENTER_HORIZONTAL可能会导致您的问题:

Here I believe your question has already been solved before, adding certain layouts to the element "EditText" such as "android:gravity="center_horizontal" may cause your problem:

<一个href=\"http://stackoverflow.com/questions/8156924/how-to-add-hint-into-edittext-with-inputtype-numberdecimal\">How添加到提示用的EditText = inputType下&QUOT; numberDecimal&QUOT;?

尝试移除,并在使用的布局包裹。机器人:重力=CENTER_HORIZONTAL,并把的EditText元素中

Try removing that and wrap it in a layout that uses "android:gravity="center_horizontal" and put the "EditText" element inside.

在计算器上的例子:

<一个href=\"http://stackoverflow.com/questions/6171139/rows-dont-render-properly-in-android-layout-buttons-seem-to-be-the-problem\">Rows不要在Android的布局正确呈现。按钮似乎是问题

在这里做一个快速谷歌搜索是一些例子,人们得到它的工作:

Doing a quick Google search here are some examples where people have gotten it to work:

<一个href=\"http://technicalmumbojumbo.word$p$pss.com/2011/11/18/android-tutorial-part-calculator-app-application-example/\" rel=\"nofollow\">http://technicalmumbojumbo.word$p$pss.com/2011/11/18/android-tutorial-part-calculator-app-application-example/

<一个href=\"http://android10.org/index.php/articlesother/203-unit-testing-with-the-junit-testing-framework\" rel=\"nofollow\">http://android10.org/index.php/articlesother/203-unit-testing-with-the-junit-testing-framework

http://www.bogotobogo.com/Android/androidAppsMortgageCalculator.php

再一次,你没有张贴您正在使用的XML的code片段,所以这是我最好的猜测,只是想帮助!

Once again, you didn't post a code snippet of the XML you are using, so this is my best guess, just trying to help!

问候,

这篇关于淡淡的EditText不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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