5 years ago (2015-05-27)  Front end and interface Software development |   First to comment  38 
post score 0 times, average 0.0

After coming out of android4.4, the immersive status bar fired inexplicably, and recently, the Android phone of the extremely guest had inadvertently updated a few common software, such as everyday sounds, wps office, and found that these softwares have not changed substantially. However, they have gradually achieved immersive status bar effects.When the very guests first saw the term, they thought it was a very big technology and they didn't know whether or not you thought it.However, when we really know what the so-called and legendary immersive status bar is after, it is really discovered that it is not as famous as it is to meet. Immersive status bar Whether or not immersive is tall, but it is very hot, it also becomes the highlight of each brush pack speculation in Brush Forum. .Extreme guests here are still introducing how to implement immersive status bar effects for mobile apps with Android 4.4 and above in Android development. Android's code to implement an immersive status bar is fairly simple.Add the following code in the activity code:

Android development to achieve immersive status bar code:

 

Code analysis:

Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT This sentence is to obtain the current mobile phone SDK version number is greater than or equal to Build.VERSION_CODES.KITKAT (Android 4.4, details see Appendix) and execute the following code:

Build.VERSION_CODES class: Currently known enumeration classes for the SDK version numbers. These values ​​can be found in the SDK. Each time the official release, these values ​​are monotonically increasing.

SDK version number appendix:

  • First Edition: Build.VERSION_CODES.BASE
  • Version 1.1: Build.VERSION_CODES.BASE_1_1
  • Version 1.5: Build.VERSION_CODES.CUPCAKE
  • This version of the official is not released: Build.VERSION_CODES.CUR_DEVELOPMENT
  • Version 1.6: Build.VERSION_CODES.DONUT
  • Version 2.0: Build.VERSION_CODES.ECLAIR
  • Version 2.0.1: Build.VERSION_CODES.ECLAIR_0_1
  • Version 2.1: Build.VERSION_CODES.ECLAIR_MR1
  • Version 2.2: Build.VERSION_CODES.FROYO
  • Version 2.3: Build.VERSION_CODES.GINGERBREAD
  • Version 2.3.3: Build.VERSION_CODES.GINGERBREAD_MR1
  • Version 3.0: Build.VERSION_CODES.HONEYCOMB
  • Version 3.1: Build.VERSION_CODES.HONEYCOMB_MR1
  • Version 3.2: Build.VERSION_CODES.HONEYCOMB_MR2
  • Version 4.0: Build.VERSION_CODES.ICE_CREAM_SANDWICH
  • Version 4.0.3: Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1
  • Version 4.1: Build.VERSION_CODES.JELLY_BEAN
  • Version 4.2: Build.VERSION_CODES.JELLY_BEAN_MR1
  • Version 4.3: Build.VERSION_CODES.JELLY_BEAN_MR2+NEWLINE);
  • Version 4.4: Build.VERSION_CODES.KITKAT);

note:

1 Add the following code interface, all controls will move up, but the title bar "actionbar" except the very guests drummed a long time code did not solve how to put the actionbar on the top of the mobile interface, it is recommended that you set the theme of the activity theme : "noactionbar".The implementation is as follows: Add the activity tag in the manifest file:

2 You may need to write your own title bar at the top of the layout

If you have a better way, welcome to leave a message and learn together!

 

This article has been printed on copyright and is protected by copyright laws. It must not be reproduced without permission.If you need to reprint, please contact the author or visit the copyright to obtain the authorization. If you feel that this article is useful to you, you can click the "Sponsoring Author" below to call the author!

Reprinted Note Source: Baiyuan's Blog>>https://wangbaiyuan.cn/en/android-development-for-immersion-status-bar-2.html

Post comment

Style

No Comment

登录

Forget password?

您也可以使用第三方帐号快捷登录

切换登录

注册

TW