Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change android theme from cordova config.xml

At my company we are using Ionic Framework and Cordova to create our mobile app, and upon starting the design of the app, we encountered an issue with the Android theme and how to set it without touching the AndroidManifest generated by Ionic build command.

Everywhere I look it is recommended to implement any customization from the config.xml file and never touch the AndroidManifest, but I cant seem to find any methods regarding the Android theme.

My question to you now: Is there a way to set the android theme for the application, for example Holo Theme, from the Config.xml without changing the AndroidManifest.xml generated?

like image 546
Jad Salhani Avatar asked Apr 07 '15 11:04

Jad Salhani


1 Answers

You can do this now without any third party plugin since 6.3.0. Just add this to the config.xml

<platform name="android">
    <edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:label='@string/activity_name']" mode="merge">
        <activity android:theme="@android:style/Theme.Translucent"></activity>
    </edit-config>
</platform>

and for me it was also neccessary to add 'xmlns:android="http://schemas.android.com/apk/res/android" ' to the widget tag

<widget id="de.bestellkind.restaurant" version="1.0.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
like image 200
Simon Ludwig Avatar answered Nov 10 '22 03:11

Simon Ludwig