R rudystyle Member Licensed User Longtime User Apr 18, 2016 #1 I tried to use a custom theme but I always get the following error AndroidManifest.xml:19: error: Error: No resource found that matches the given name (at 'theme' with value '@style/MyTheme'). I created a theme.xml under res/values folder. The theme.xml file has the following content <?xml version="1.0" encoding="utf-8"?> <resources> <style name="MyTheme" parent="Theme.Holo.Light"> </style> </resources> My manifest file has SetApplicationAttribute(android:theme, "style/MyTheme") I also tried SetApplicationAttribute(android:theme, "@android:style/MyTheme") But both don't work. I am using platforms\android-21\android.jar in configure paths
I tried to use a custom theme but I always get the following error AndroidManifest.xml:19: error: Error: No resource found that matches the given name (at 'theme' with value '@style/MyTheme'). I created a theme.xml under res/values folder. The theme.xml file has the following content <?xml version="1.0" encoding="utf-8"?> <resources> <style name="MyTheme" parent="Theme.Holo.Light"> </style> </resources> My manifest file has SetApplicationAttribute(android:theme, "style/MyTheme") I also tried SetApplicationAttribute(android:theme, "@android:style/MyTheme") But both don't work. I am using platforms\android-21\android.jar in configure paths
JTmartins Active Member Licensed User Longtime User Apr 18, 2016 #2 I think you have to make the theme.xml as a read only file or it will be deleted at compile time. Upvote 0
DonManfred Expert Licensed User Longtime User Apr 18, 2016 #3 or use an additionalres directive and create a new path for the theme.xml (or other resources) Upvote 0
R rudystyle Member Licensed User Longtime User Apr 18, 2016 #4 I set it to read only but it's still giving the same error Upvote 0
DonManfred Expert Licensed User Longtime User Apr 18, 2016 #5 without seeing your code we just can guess Upload the project so we can see better where the problem may be Upvote 0
without seeing your code we just can guess Upload the project so we can see better where the problem may be
R rudystyle Member Licensed User Longtime User Apr 18, 2016 #6 Thanks for the inputs. I had the res folder out side the Object folder. Found out that it has to be inside the Objects folder. Also put the res folder as Read only otherwise compiler deletes the files Upvote 0
Thanks for the inputs. I had the res folder out side the Object folder. Found out that it has to be inside the Objects folder. Also put the res folder as Read only otherwise compiler deletes the files
Erel B4X founder Staff member Licensed User Longtime User Apr 18, 2016 #7 If you are using B4A v5.80 then the best way is to use CreateResource. For example to create a light theme based on the native theme on both Android 4 and Android 5+: B4X: SetApplicationAttribute(android:theme, "@style/LightTheme") CreateResource(values-v20, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Material.Light"> </style> </resources> ) CreateResource(values-v14, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Holo.Light"> </style> </resources> ) Upvote 0
If you are using B4A v5.80 then the best way is to use CreateResource. For example to create a light theme based on the native theme on both Android 4 and Android 5+: B4X: SetApplicationAttribute(android:theme, "@style/LightTheme") CreateResource(values-v20, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Material.Light"> </style> </resources> ) CreateResource(values-v14, theme.xml, <resources> <style name="LightTheme" parent="@android:style/Theme.Holo.Light"> </style> </resources> )