1

I want to use onSizeChange to detect the height difference in a LinearLayout when the soft keyboard comes on screen. I want to issue fullScroll(View.FOCUS_DOWN); at that point. An example would be greatly appreciated.

Charles Sprayberry
  • 7,741
  • 3
  • 41
  • 50
Noah Seidman
  • 4,359
  • 5
  • 26
  • 28

1 Answers1

1

I do not understand your question, but here is an example. You already know that you should use onSizeChange, but exactly where do you run into problem?

public class SizeChangingLinearLayout extends LinearLayout {
    //...
    @Override
    protected void onSizeChanged(int xNew, int yNew, int xOld, int yOld)
    {        
        if (yNew < yOld) 
            fullScroll(View.FOCUS_DOWN)
        else if (yNew > yOld) 
            fullScroll(View.FOCUS_UP)

        super.onSizeChanged(xNew, yNew, xOld, yOld);

    }
}

SizeChangingLinearLayout is the root view of the Activity. It only changes when the keyboard comes on, on landscape mode, and so on.

Does this help?

JOG
  • 5,590
  • 7
  • 34
  • 54