Objective
Bloggers have recently been in touch with mobile apps and learned a few tips to share with you.
Now open the vast majority of apps, the status bar is integrated with the app, not only beautiful, but also with the overall coordination.
Bo Master is a degree of obsessive-compulsive disorder, the top of the small black bar really makes me uncomfortable.
First, we create a new mobile app project on the Hbuilder.
1.1 immersive status bar (status bar transparent)
Generally, the entire page is a picture, making the status bar transparent.
First, detect if the current environment supports an immersive status bar. Detection statement:
<script type= "Text/javascript" > document.addeventlistener (function() { // whether the immersive status bar is supported alert (Plus.navigator.isImmersedStatusbar ()); }); </script>
Default is not supported, will eject false. To make the environment support, you need to modify the configuration file under the project Manifest.json
There is a manifest.json file under the project, open, open code view:
Add under Code view "plus"
"StatusBar": { true },
:
When the modification is complete, it will pop up true, with the following effect:
Terminal support:
1.2 status bar fullscreen
Status bar Full screen is no status bar, do not display the power, signal that one.
The effect is to add a statement to the JS file:
<script type= "Text/javascript" > document.addeventlistener (function() { // parameter: true-fullscreen; false-not full screen Plus.navigator.setFullscreen (true); }); </script>
The effect is as follows:
1.3 status bar background color
Modify the background color is generally used for the top of the page background color for a solid color scene, modified to the page consistent background color, make the page more harmonious.
// set the system status bar background color plus.navigator.setStatusBarBackground (' #6495ED ');
The Android platform does not support this feature, if you have a great God, please give me a lot of advice.
Blurred image can give people a hazy beauty effect. Click the image blur effect that you didn't mention before:
CSS Properties Filter:
Filter:blur (16PX);
The Pixels in blur () are the degree of ambiguity.
| 3. Simply use the MUI Quick Build page |
The front most bothered me the status bar problem solved, the page layout is good to run. Use the MUI template to quickly build it.
Take XX Music as an example:
2.1 < Strong class= "135brush" style= "Border-color: #59c3f9; Color:inherit; "data-brushtype=" text "> import file
<src= "Js/mui.min.js"></script> <href= "Css/mui.min.css" rel= "stylesheet"/ > <rel= "stylesheet" href= "css/ Bofang.css "/>
2.2html code
The following HTML code is used for the MUI Frame section and the related section of the above status bar, this MUI is about the area Carousel Section
The top IMG is the background map, the outer wrapping div is very necessary, the overflow attribute should be utilized, in order to have the perfect effect.
Because the app's header part uses the positioning, so the main part of the page to add height of about 74px padding-top
<Divclass= "Mui-slider"> <Divclass= "Mui-slider-group"> <Divclass= "Mui-slider-item">First Carousel Area</Div> <Divclass= "Mui-slider-item"> <Pclass= "Singer"> <spanclass= "CE"></span> <spanclass= "Mui-text-center">G-dragon</span> <spanclass= "CE"></span> </P> <Pclass= "Yinxiao"> <imgsrc= "Img/player_btn_sq_hlight.png"/> <imgsrc= "Img/player_btn_mv_normal.png"/> <imgsrc= "Img/player_btn_dts_on.png"/> </P> <Divclass= "Datu"> <imgsrc= "Img/gd.jpg"/> </Div> <Pclass= "Geci">A Boy-g-dragon</P> </Div> <Divclass= "Mui-slider-item">Second Carousel Area</Div> </Div> <Divclass= "Mui-slider-indicator"> <Divclass= "Mui-indicator"></Div> <Divclass= "Mui-indicator mui-active"></Div> <Divclass= "Mui-indicator"></Div> </Div> </Div>
Main CSS code:
*{padding:0px;margin:0px;}Body{Overflow:Hidden;Height:100VH;}#background{Overflow:Hidden;text-align: Right;}#background #backImg{Margin-left:-120px;Height:99VH;Filter:Blur (16px);}. Mui-bar-nav{Top:30px;Background-color:Rgba (0,0,0,0);Box-shadow:0 0px 0px #ccc;}. Mui-bar-nav. Mui-title{Color: White;font-size:20px;Font-weight:Normal;Line-height:50px;}#continer{width:100%;Height:100VH;position:relative;Top:-100VH;Z-index:5;Padding-top:80px;Background-color:Rgba (0,0,0,0.7);text-align:Center;Color: White;}
A picture with a different size at the back is centered. This is not a moment to remember. Here you will use the cross-axis alignment of the elastic layout:
#continer. Footer1 { margin-bottom: 0px; display: flex; align-items: Center; justify-content: center;}
Show the following effect:
Little Q has to say
Bo Master blog is also want to improve themselves, but also asked the great God advice.
In addition, the framework is really good, but bloggers think, still have to master the native code first.
MUI Framework mobile development first experience