Android to determine if navigation Bar is transparent

Source: Internet
Author: User

Set Navigation Bar Transparent

GetWindow (). Addflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
or add <item name= "Android:windowtranslucentnavigation" in theme >true</item>

  /**     * Convenience function to set the flag bits as specified in flags, as     * per {@link #setFlags}.     * @param flags the flag bits to be set.     * @see #setFlags     * @see #clearFlags */public    void addflags (int flags) {        setflags (flags, flags);    }


/** * Set The flags of the window, as per the * {@link windowmanager.layoutparams windowmanager.layoutparams}     * Flags.     * * <p>note that some flags must being set before the window decoration is * created * {@link #setContentView (View, Android.view.ViewGroup.LayoutParams)} or * {@link #getDecorView ()}: * {@link Windo  Wmanager.layoutparams#flag_layout_in_screen} and * {@link Windowmanager.layoutparams#flag_layout_inset_decor}. These * 'll be set to the based on the {@link Android.     r.attr#windowisfloating} * attribute.     * * @param flags The new window flags (see WINDOWMANAGER.LAYOUTPARAMS).     * @param mask which of the window flag bits to modify. * @see #addFlags * @see #clearFlags */public void setflags (int flags, int mask) {final WINDOWMANAGER.L        Ayoutparams attrs = GetAttributes (); Attrs.flags = (Attrs.flags&~mask) |        (Flags&mask); if ((MASK&AMP;WINDOWMANAGER.LAyoutparams.flag_needs_menu_key)! = 0) {attrs.privateflags |= WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEED        S_menu_key;        } mforcedwindowflags |= Mask;        if (mcallback! = null) {mcallback.onwindowattributeschanged (attrs); }    }

which
Attrs.flags = (Attrs.flags&~mask) | (Flags&mask);

Who can explain the meaning of this line of code? I've forgotten everything I've learned.

So

public boolean existflag (int flags) {    windowmanager.layoutparams attrs= GetWindow (). GetAttributes ();    if (Attrs.flags = = ((attrs.flags&~flags) | (flags&flags))) {    return true;    }    return false;}

KitKat on the validation pass.


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.