How to get Holo Light theme working in my Xamarin app

I am trying to get my application to use the Holo.Light theme. I created a custom theme for Holo and put it in

Resourses \ values-v11 \ FsmTheme.xml

<?xml version="1.0" encoding="utf-8" ?> <resources> <style name="FsmTheme" parent="@android:style/Theme.Holo.Light"> </style> </resources> 

I also created one for older versions and put it in

Resourses \ Values ​​\ FsmTheme.xml

 <?xml version="1.0" encoding="utf-8" ?> <resources> <style name="FsmTheme" parent="@android:style/Theme.Light.NoTitleBar"> </style> </resources> 

Then I added it to my AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionCode="001" android:versionName="001" package="futurestate.app.droid"> <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="14" /> <application android:label="FutureState App Demo" android:icon="@drawable/Icon" Theme="@style/FsmTheme" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.INTERNET" /> </manifest> 

I'm not sure what else I need to do to get the theme in the app.

enter image description here

+6
source share
2 answers

Breakdown in this line.

 <application android:label="FutureState App Demo" android:icon="@drawable/Icon" Theme="@style/FsmTheme" /> 

Some tutorials have

 Theme="@style/ThemeName" 

but you have to structure it like the rest of the elements

 android:theme="@style/ThemeName" 

So the final structure will read

 <application android:label="FutureState App Demo" android:icon="@drawable/Icon" android:theme="@style/FsmTheme" /> 
+5
source

You can use attributes to change values ​​in AndroidManifest.xml, for example, this changes the theme to bare light:

 [Activity( Label = "Foobar", MainLauncher = true, Theme = "@android:style/Theme.Holo.Light" )] public class MainActivity : Activity { ... } 

You can also do this at the application level.

But for your specific problem, it seems that you will name your style files FsmTheme.xml . This is not true. You must specify any styles.xml style resources, so if you rename your files to Resources/values/styles.xml and Resources/values-v11/styles.xml , everything should work as expected.

+14
source

Source: https://habr.com/ru/post/959340/


All Articles