Question

My application has structure like below-

<RelativeLayout>
    ...
    <ScrollView>
        <LinearLayout>
         ....
         <EditText ... />
         ....
        </LinearLayout>
    </ScrollView>
    ...
</RelativeLayout>

When I am trying to input values in EditText, it loses focus and scrolls up to top.

It is focused when I first click it, but loses when I click any values (a-z) of softkeyboard.

Important issue is Application works fine on other devices and has this error only on certain devices (e.g. galaxy S4)

I already made 'adjustpan' and EditText's focusable true.

And there is no focus handling source in .java file.

Anyone has solution to this problem?

or Galaxy S4 has any issue on this problem?

Was it helpful?

Solution

I found the reason.

This issue only works on the condition below

  1. Galaxy S4
  2. using EditText with 'number' inputType
  3. using gravity not left (only horizontal gravity makes issue. any vertical gravity works as normal)

So I did like below

  1. make empty space (marginBottom) so that keyboard may not block edittext
  2. For some Edittext, set gravity to left and calculate device pixel and give edittext marginLeft so that edittext works as if it's gravity is right

If anyone has better solution, please tell me how..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top