Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. import android.graphics.Color;
  2. import android.os.Build;
  3. import android.os.Bundle;
  4. import android.view.View;
  5. import android.view.Window;
  6.  
  7. import io.flutter.app.FlutterActivity;
  8. import io.flutter.plugins.GeneratedPluginRegistrant;
  9.  
  10.  
  11. public class MainActivity extends FlutterActivity
  12. {
  13. @Override
  14. protected void onCreate(Bundle savedInstanceState)
  15. {
  16. super.onCreate(savedInstanceState);
  17. GeneratedPluginRegistrant.registerWith(this);
  18. drawUnderSystemUi();
  19. }
  20.  
  21. @Override
  22. protected void onPostResume()
  23. {
  24. super.onPostResume();
  25. drawUnderSystemUi();
  26. }
  27.  
  28.  
  29. private void drawUnderSystemUi()
  30. {
  31. if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
  32. Window window = getWindow();
  33. int color;
  34. if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
  35. color = Color.TRANSPARENT;
  36. }
  37. else{
  38. color = 0x22000000;
  39. }
  40. window.setNavigationBarColor(color);
  41. window.getDecorView().setSystemUiVisibility(
  42. View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
  43. View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
  44. View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement