Note that there are some explanatory texts on larger screens.

plurals
  1. POStop ScrollView from auto-scrolling to an EditText
    primarykey
    data
    text
    <p>Seems to be a common problem without a great solution that I have found. Goal is to stop a <code>ScrollView</code> from auto-scrolling to an <code>EditText</code> (or any view for that matter) that has focus.</p> <p>You have a bunch of views (<code>Button</code>s, <code>TextView</code>s, etc) in an <code>ScrollView</code>, one of which is an <code>EditText</code>. Upon clicking say a Button within the <code>ScrollView</code>, the <code>ScrollView</code> scrolls down to the <code>EditText</code> (its off screen). This is not desired, as there are other elements that you don't want scrolled off the screen. </p> <p>Now I can stop this from happening when the screen first shows by having other focusable elements in the <code>ScrollView</code>. However, the general problem still exists. The user scrolls down manually to the <code>EditText</code>, enters some numbers, then scrolls up to the top (<code>EditText</code> off screen now), they click a button in the <code>ScrollView</code>, and guess what? The <code>ScrollView</code> scrolls down to that darn <code>EditText</code>.</p> <p>I'm thinking about extending the <code>ScrollView</code> and overriding some of the methods there like <code>findFocusableViewInBounds</code>, but I have a feeling I'll just be getting myself into more trouble.</p> <p>Please help if you can. </p> <p>I've played around with things like having an 0 height <code>EditText</code> at the top of my <code>ScrollView</code>, adding Next Focusable element properties to the other items in the <code>ScrollView</code>, etc. I suppose one "hack" might be to get the <code>EditText</code> to lose focus when the virtual or manual keyboard gets hidden or something.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload