2

I have an EditText with input_type "number". It lives inside a layout which is an item inside a ListView.

The problem is the following: when I touch the EditText, I quickly get the soft numerical keyboard, but in less than a second it automatically changes to regular soft keyboard showing all letters. Obviously, I want the numerical keyboard.

To add more weirdness to the problem, if I change the layout_height of the ListView from match_parent to wrap_content, the problem doesn't occur. But unfortunately I need to keep the ListView with height match_parent.

Anyone has any ideas? Thanks!

Jordi Chacón
  • 1,723
  • 1
  • 14
  • 20
  • Solved it like this http://stackoverflow.com/questions/6918494/edit-text-in-listactivity-listview-looses-focus-when-keyboard-comes-up – Jordi Chacón Apr 22 '14 at 20:04
  • Chacon I am having same problem even tried to change the the layout height of listview. I have added android:descendantFocusability="afterDescendants" and adjustPan in manifest file.Do you have any other idea? – Karthikeyan Ve May 21 '15 at 12:13
  • same issue happen with me but in my case it happens only in 7.0 ( nought ) and above API level – Sushant Gosavi Sep 12 '17 at 11:38
  • Can you tell me that which version of android you are testing – Sushant Gosavi Sep 12 '17 at 11:39

1 Answers1

0

I could be wrong but you may want to consider changing your design by placing any edit text fields within a scrollview. The getView method of your list adapter gets called multiple times at unpredictable intervals that you will not be able to control. This will cause any init code you have in xml or code to be re initialized over and over again with some interesting results. If you have multiple elements in your list items that may be what is cause the keyboard to "work" when you adjust the height.

Patty P
  • 351
  • 2
  • 12