Created
May 13, 2019 14:55
-
-
Save slightfoot/ae61a83fd6c09bd5d907d6b87e96fc84 to your computer and use it in GitHub Desktop.
Transparent Navigation in #Flutter App. 13th May 2019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Build; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.view.Window; | |
import io.flutter.app.FlutterActivity; | |
import io.flutter.plugins.GeneratedPluginRegistrant; | |
public class MainActivity extends FlutterActivity | |
{ | |
@Override | |
protected void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); | |
GeneratedPluginRegistrant.registerWith(this); | |
drawUnderSystemUi(); | |
} | |
@Override | |
protected void onPostResume() { | |
super.onPostResume(); | |
drawUnderSystemUi(); | |
} | |
private void drawUnderSystemUi() | |
{ | |
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ | |
Window window = getWindow(); | |
window.setStatusBarColor(0x22000000); | |
window.setNavigationBarColor(0x22000000); | |
window.getDecorView() | |
.setSystemUiVisibility( | |
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | | |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | | |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment