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