1

When I try to press the EditText for it to gain focus, it only works from the middle of it to the left. If I press from the middle to the right nothing happens.

(It has width = fill_parent).

I tested on Android 2.2 and 4.2.1. Same behaviour on both.

Why does this happen and can it be "fixed"?

Is it an Android platform bug?

UPDATE:

First I was thinking it had something to do with hidding the keyboard on activity start but i've tried 4 options:

Adding to the base LinearLayout (Check Stop EditText from gaining focus at Activity startup)

<LinearLayout
....
android:focusable="true"
android:focusableInTouchMode="true" />

I've also tried:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

And changing on the Manifest:

<activity.... android:windowSoftInputMode="adjustUnspecified|stateHidden"/>

And using the default behaviour.

...all have the same behaviour described above.

Community
  • 1
  • 1
neteinstein
  • 17,529
  • 11
  • 93
  • 123
  • if you want to avoid keyboard appearing on activity startup, you should use code in my answer. Now if your edittext acts 'strangely', this is something different. Where are you testing your apps? on 2.2 and 4.2 emulators? – Paschalis Dec 05 '12 at 11:43
  • No. On 2.2 and 4.2 devices. – neteinstein Dec 05 '12 at 12:00

3 Answers3

0

Question updated. Old answer:

Remove what you did in your linear layout xml file, and put this code on you activity on create method, so you prevent keyboard from auto-popup:

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Paschalis
  • 11,929
  • 9
  • 52
  • 82
  • so the problem now is that only the half edittext is clickabe? – Paschalis Dec 05 '12 at 15:00
  • Yes exactly. I think that it might be a platform issue (http://code.google.com/p/android/issues/detail?id=40968&thanks=40968&ts=1354714580) but a way to avoid this problem or solve it (and a confirmation that it is) are welcome! – neteinstein Dec 05 '12 at 15:24
  • try your binary in a simulator too... to see if there is okay... also try putting another edittext, to find out if any 'leftovers' of your previous attempts to hide soft-keyboard caused this.. – Paschalis Dec 06 '12 at 01:37
0

Why did you add the android:focusable="true" android:focusableInTouchMode="true" to the LinearLayout? In every LinearLayout, focus will be on the first focusable item on page load. If you want the focus o some other view add a tag after the view in the layout.

viks
  • 404
  • 2
  • 6
  • 14
-1

Solved the problem. It had to do with the EditText width.

neteinstein
  • 17,529
  • 11
  • 93
  • 123