开发者

EditText does not lose focus after it gains it

开发者 https://www.devze.com 2023-02-17 03:51 出处:网络
At first my EditText had the focus as soon as the app loaded the screen and I disabled that with android:focusable=\"true\"

At first my EditText had the focus as soon as the app loaded the screen and I disabled that with

android:focusable="true" 
android:focusableInTouchMode="true"

However, there is no way to lose focus after clicking the EditText. The focus is still t开发者_如何学Pythonhere when I try to click outside of the text area. This also happens when I click on the EditText to change the value and press "Done" on the on screen keyboard. Does anyone know a way for me to accomplish this?


Focus only changes if you click on something else that can gain focus. Issue is: If you click on a button for instance you might not lose focus, unless you do what Mathew said. Problem with that is: A button whose focusableInTouchMode is set to "true", needs now to be clicked TWICE: Once for gaining focus and once for performing OnClick. A nagging issue, that was haunting me as well right now.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号