0

I have my styles.xml file for the app:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:textColor">#000000</item>
    <item name="android:background">#FFFFFF</item>
</style>

I want to make it so that if a user selects a value from a spinner then that value changes the textColor in the styles app.

I have my onClick method and I have the value from the spinner but I can't figure out how I access the textColor styles item and how I dynamically change it?

user2633709
  • 103
  • 2
  • 9

2 Answers2

0

I didn't manage to do exactly what I wanted but a workaround was that I only let the user choose between 3 font colours: black, blue, and red, and then I had 3 themes. Each theme had the different text colour.

Then I just switched the theme following this answer: Android - Change app Theme on onClick

Community
  • 1
  • 1
user2633709
  • 103
  • 2
  • 9
0

One way to achieve this is to make a color.xml resource in the rescourses folder and link to it in the activity layout.

Also why do you have css as one of the tags for this question?

Rather it should be XML.