Skip to content

Instantly share code, notes, and snippets.

@slightfoot
Created May 13, 2019 14:55
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save slightfoot/ae61a83fd6c09bd5d907d6b87e96fc84 to your computer and use it in GitHub Desktop.
Transparent Navigation in #Flutter App. 13th May 2019
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