Statusbar/toolbar hidden display, form background settings

Source: Internet
Author: User

Direct, like the effect of a photo album.

Both images are hidden StatusBar (status bar), the first shows toolbar, the form background is white, the second hides the toolbar, the form background is black. (The first one below is a layout_width= "fill_parent" of the TextView, click is hidden)

First of all, StatusBar (status bar) of the hidden, here directly in the theme inside style add a

<name= "Android:windowfullscreen">true</Item  >

or android:theme= "@android: Style/theme.notitlebar.fullscreen",

Or add code to the activity.

GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN,         WindowManager.LayoutParams.FLAG_ fullscreen);

Next, the return arrow to the left of the toolbar (Google does not recommend it)

Getsupportactionbar (). setdisplayhomeasupenabled (true);

When the screen is touched, the response event

@Override Public Booleanontouchevent (Motionevent event) {//TODO auto-generated Method Stub        if(event.getaction () = =Motionevent.action_down) {//screen is touchedif(s = = 1) {//hides toolbar and TextView showtoolbar.animate (). Translationy (-showtoolbar.getheight ()). Setinterpolator (NewAccelerateinterpolator (2)); Property Animation Framelayout.layoutparams LP=(Framelayout.layoutparams) titleshower.getlayoutparams (); intFabbottommargin =Lp.bottommargin; Titleshower.animate (). Translationy (Titleshower.getheight ()+ fabbottommargin). Setinterpolator (NewAccelerateinterpolator (2) . Start ();          Shower.setbackgroundcolor (Color.Black); Layout s of the current page= 0; } Else{showtoolbar.animate (). Translationy (0). Setinterpolator (NewDecelerateinterpolator (2)); Titleshower.animate (). Translationy (0). Setinterpolator (NewDecelerateinterpolator (2) . Start ();                Shower.setbackgroundcolor (Color.White); S= 1; }        }        return true; }

The property animations are added to hide and show, and are slowly hidden.

Statusbar/toolbar hidden display, form background settings

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.