11package com .uis .stackview .demo .activity ;
22
33import android .content .Intent ;
4+ import android .graphics .Color ;
45import android .net .Uri ;
6+ import android .os .Build ;
57import android .os .Bundle ;
68import android .util .Log ;
79import android .view .LayoutInflater ;
810import android .view .View ;
911import android .view .ViewGroup ;
12+ import android .view .Window ;
13+ import android .view .WindowManager ;
1014import android .widget .Toast ;
1115
1216import com .facebook .common .logging .FLog ;
2327import androidx .appcompat .app .AppCompatActivity ;
2428import androidx .recyclerview .widget .LinearLayoutManager ;
2529import androidx .recyclerview .widget .RecyclerView ;
26-
30+ import android . view . WindowManager ;
2731/**
2832 * Created by xmuSistone on 2017/5/12.
2933 */
@@ -35,8 +39,25 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
3539
3640 @ Override
3741 protected void onCreate (Bundle savedInstanceState ) {
42+ if (Build .VERSION .SDK_INT >= 19 ){
43+ if (Build .VERSION .SDK_INT >= 23 ){
44+ getWindow ().addFlags (WindowManager .LayoutParams .FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS );
45+ getWindow ().setStatusBarColor (Color .TRANSPARENT );
46+ getWindow ().getDecorView ().setSystemUiVisibility (View .SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
47+ //只有白色背景需加上此flag
48+ |View .SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
49+ );
50+ }else {
51+ getWindow ().addFlags (WindowManager .LayoutParams .FLAG_TRANSLUCENT_STATUS );
52+ }
53+ }
54+
3855 super .onCreate (savedInstanceState );
3956 setContentView (R .layout .activity_main );
57+ if (Build .VERSION .SDK_INT >= 19 ){
58+ ViewGroup .LayoutParams params = findViewById (R .id .view ).getLayoutParams ();
59+ params .height = getResources ().getDimensionPixelSize (R .dimen .status_height );
60+ }
4061 FLog .setMinimumLoggingLevel (FLog .VERBOSE );
4162 if (!Fresco .hasBeenInitialized ()) {
4263 ImagePipelineConfig config = ImagePipelineConfig .newBuilder (getApplicationContext ())
0 commit comments