Skip to content

Instantly share code, notes, and snippets.

@Buom01
Last active December 23, 2019 18:03
Show Gist options
  • Save Buom01/9bd08a292e1cc006cf8cc160b89f9869 to your computer and use it in GitHub Desktop.
Save Buom01/9bd08a292e1cc006cf8cc160b89f9869 to your computer and use it in GitHub Desktop.
TWA splashscreen
<!---
IMPORTANT NOTE: This gist in now useless since splashscreen are now supported: https://github.com/GoogleChromeLabs/svgomg-twa/pull/23/files#diff-4ad2826e1292d083a4995de57bfaf133
-->
<!-- import here your svg logo (in drawables)
See https://stackoverflow.com/questions/30923205/easiest-way-to-use-svg-in-android/39266840#39266840
-->
<!-- put this file in drawables -->
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@color/colorPrimary"/>
<item
android:gravity="center"
android:drawable="@drawable/ic_logo"
android:height="150dp"
android:width="150dp" />
</layer-list>
<!--
Copyright 2019 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---
Adapted from https://github.com/GoogleChromeLabs/svgomg-twa
-->
<resources>
<!-- Theme to create a blank screen while the TWA is opening -->
<style name="Theme.TwaSplash" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:statusBarColor">@color/colorPrimary</item> <!-- Make all the srcreen of the same color without fullscreen keeping statusbar and navigation (virtual home buttons (...)) visible but unicolor color -->
<item name="android:navigationBarColor">@color/colorPrimary</item>
</style>
</resources>
@JacobDB
Copy link

JacobDB commented Dec 23, 2019

I realize this is outdated now, but have you ever had luck with the navigationBarColor property? I can't seem to get it to work, and I'd like to make the navigation transparent for my main view in my TWA on Android 10+, as described here https://medium.com/androiddevelopers/gesture-navigation-going-edge-to-edge-812f62e4e83e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment