Edit Text in ListActivity ListView loses focus whe

2019-01-11 09:47发布

I have searched and searched for an answer to this question and everything that looked like an answer has not worked so I guess I will just ask.

I have a couple of EditText boxes added to a ListView that is the basis to a ListActivity. When I set the windowSoftInputMode to adjustPan and click in an EditText it works until you click on it again and then the keyboard covers it up. When I use adjustResize it works except when the keyboard comes up the EditText loses focus and I have to tap on it again to type.

I was trying to figure out how to catch the onResize but that seems to be associated with the View and not the activity and I'm not entirely sure how to listen for it. I have also tried all sorts of focusable settings on the EditText boxes and the ListView itself (as suggested in other posts I read) that don't seem to help either.

7条回答
我想做一个坏孩纸
2楼-- · 2019-01-11 10:52

I have experienced exactly the same issue in my project.

To resolve the issue I have subclassed the EditText and handled the "Back" button press - to make sure that my EditTextclears focus at that moment.

Check this solution, on how to do it.

Good luck.

查看更多
登录 后发表回答