大家好
首先感谢您阅读本文。
当我失去焦点时,我很难找到更改 EditText 的方法。
我希望它在发生这种情况时变灰,但我不希望它被禁用,因为用户可以触摸它并稍后编辑文本。
Anyone?
问候!
You can 为文本设置不同的颜色 http://developer.android.com/reference/android/widget/TextView.html#setTextColor%28int%29基于一个OnFocusChangeListener http://developer.android.com/reference/android/view/View.OnFocusChangeListener.html
另一种选择是在 xml 中设置样式。详情请参阅此问题:Android:焦点时改变样式 https://stackoverflow.com/questions/1572868/android-change-style-when-focused
要更改不透明度,请使用setAlpha http://developer.android.com/reference/android/view/View.html#setAlpha%28float%29。在这个答案中,我展示了如何在动画中做到这一点:关于自定义应用程序 ui 和 AlphaAnimation 的两个问题 https://stackoverflow.com/questions/6085912/two-questions-about-custom-app-uis-and-alphaanimation/6086125#6086125
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)