How to grey out Views. Specifically an EditText?

家住魔仙堡 提交于 2020-01-02 05:06:12

问题


Hey guy's First of all thanks for reading this. I'm having trouble to find a way to change my EditText when I loose focus to it. I would like it to be greyed out when this happens, but I don't want it to be disabled because the user can touch it and edit the text later.

Anyone?

Greetings!


回答1:


You can set different colors to the text based on an OnFocusChangeListener

Another option is to set a style in xml. See this question for details: Android: change style when focused

To change the opacity, use setAlpha. In this answer I show it how to do it in an animation: Two questions about custom app ui's and AlphaAnimation



来源:https://stackoverflow.com/questions/6100203/how-to-grey-out-views-specifically-an-edittext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!