Faksprod commented on issue #844:
URL: https://github.com/apache/cordova-android/issues/844#issuecomment-924337939
@karimlahbach after a day of test I finally found something for a 100%
fullscreen app (even on bordeless devices), no title bar and no navigation bar.
You have to re-write/overwrite the default Android theme which can be find
in the file `app/src/main/AndroidManifest.xml`. We will ask the app to take our
own theme with its own rules written in the files
`app/src/main/res/values/strings.xml`.
Yo can do this manually or you can do it using the helpful `<edit-config>`
tag in the Cordova `config.xml` file.
```xml
<platform name="android">
...your code...
<!--
The first edit-config tag will replace the
Theme.AppCompat.NoActionBar in the file app/src/main/AndroidManifest.xml
We indicate that we want to use our own style called MyFullTheme (or
whatever you want)
-->
<edit-config file="AndroidManifest.xml" mode="merge"
target="/manifest/application/activity">
<activity android:theme="@style/MyFullTheme"/>
</edit-config>
<!--
In this second edit-config tag we can write our new theme rules/spec
This rules will be written in the file
app/src/main/res/values/strings.xml and will overwrite the
Theme.AppCompat.NoActionBar default theme
-->
<edit-config file="strings.xml" mode="add" target="/resources">
<style name="MyFullTheme"
parent="@style/Theme.AppCompat.NoActionBar">
<item
name="android:windowLayoutInDisplayCutoutMode">shortEdges</item><!-- Use 100%
screen size even on borderless device / notch device -->
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowFullscreen">true</item><!-- Use 100%
screen size -->
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
</edit-config>
...your code...
</platform>
```
Very important: using the `<edit-config>`tag will throw a parsing error when
you will try to build the app.
Before building, you have to add a `key:value` at the `<widget>` tag at the
top of the `config.xml` file.
Add the `xmlns:android="http://schemas.android.com/apk/res/android` key in
the `<widget tag>` like below.
```xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:android="http://schemas.android.com/apk/res/android">
...your code...
</widget>
```
Hope this can help!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]