Android monitors the state of the keyboard by listening for changes in the outermost layout, which changes the outer layout of the soft keyboard (provided the mode of activity is set to compress).

Source: Internet
Author: User

outermost layout . Addonlayoutchangelistener (New Onlayoutchangelistener () {

@Override

public void Onlayoutchange (View arg0, int arg1, int arg2, int arg3,

int arg4, int arg5, int arg6, int arg7, int arg8) {

TODO auto-generated Method Stub

if (EditText. Hasfocus ()) {

/**

* There is no use of handler, so Sroderscrollview will not scroll to the bottom. Just scrolls the initialization height.

* All scroll to the bottom if scrollview too long will cause edittext to roll out of the screen

* New Handler (). Post (New Runnable (

* public void Run () {

* Scrollview.fullscroll (Scrollview.focus_down);

* }));

*/

Scrollview.fullscroll (Scrollview.focus_down);

Edittext.requestfocus ();

}

}

});

Android monitors the state of the keyboard by listening for changes in the outermost layout, which changes the outer layout of the soft keyboard (provided the mode of activity is set to compress).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.