"Android" Hide bottom virtual keys

Source: Internet
Author: User

Google's official documents are:

Https://developer.android.com/training/system-ui/navigation.html#behind

Sample code

1 View decorview = GetWindow (). Getdecorview (); 2//Hide both the navigation bar and the status Bar.3//system_ui_flag_ful Lscreen is only available on Android 4.1 and higher, but AS4//a general rule, you should design your app to hide the STA Tus bar whenever you5//hide the navigation bar.6 int uioptions = view.system_ui_flag_hide_navigation7               | View.system_ui_flag_fullscreen;8 decorview.setsystemuivisibility (uioptions);

Original:

However, there is a problem.

This can really hide the bottom virtual navigation bar, but once you tap the screen, the navigation bar will appear (for about 1 seconds) and consume your click events. If you want to click a button (the navigation bar is hidden), you need to point two times in a row. Because the navigation bar disappears after 1 seconds, clicking on the screen event will block the consumption again.

The Final Solution
  /**     * Hide virtual keys and full screen     *    /protected void Hidebottomuimenu () {        //Hide virtual keys, and fullscreen        if (Build.VERSION.SDK_ INT > One && Build.VERSION.SDK_INT < +) {//Lower API            View v = This.getwindow (). Getdecorview ();            V.setsystemuivisibility (View.gone);        } else if (Build.VERSION.SDK_INT >=) {            //for new API versions.            View Decorview = GetWindow (). Getdecorview ();            int uioptions = View.system_ui_flag_hide_navigation                            | View.system_ui_flag_immersive_sticky | View.system_ui_flag_fullscreen;            Decorview.setsystemuivisibility (uioptions);        }    }

Android hides the bottom virtual keys

Related Article

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.