Git Product home page Git Product logo

statusbar's Introduction

UI—第三弹,沉浸式状态栏

###一、概念: 沉浸式状态栏”准确来说应该是“透明栏”,英文名“Translucent Bars”,是Android 4.4 新定义的设计规范。简单来说就是在软件打开的时候通知栏和软件顶部颜色融为一体,这样可以使软件和系统本身更加融为一体,同时通知栏的颜色不再是白色、黑色简单的两种了。

###二、微信公众号: 关注微信公众号,获取密码,了解更多。 微信公众号:jike_android

公众号

###三、效果图:

效果图

###四、关键代码:

	private void setStatusBarTransparent(){
		 
		if(VERSION.SDK_INT >= VERSION_CODES.KITKAT){
	        //托盘重叠显示在Activity上
	        View decorView = getWindow().getDecorView();	        
	        int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 
	        		|View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
	        decorView.setSystemUiVisibility(uiOptions);  
	        decorView.setOnSystemUiVisibilityChangeListener(this);
	        // 设置托盘透明
	        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

	    	Log.d("CP_Common","VERSION.SDK_INT =" + VERSION.SDK_INT);
		}else{
	    	Log.d("CP_Common", "SDK 小于19不设置状态栏透明效果");
	    }
		  
	}

statusbar's People

Contributors

wch0620 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.