0

I am building an app where I want to let the user have the option to change up some colors.

Here's what the app looks like : https://i.stack.imgur.com/kxeOm.jpg

I want the "Aspect" color to determine the "Notifications" Switch's color. I know how to set it to a different one at launch but I can't seem to find a way to do it dynamically. I don't even know if it is possible but any help would be really appreciated.

Thanks.

hlbak
  • 27
  • 7

1 Answers1

0

The only way you can do this is using a selectors and styles, I hit the same roadblock some time ago. I guess you are using the aspect color for the tint of widgets.

Here is how you can make a selector.

The problem with selectors is that they consist of two images that switch depending on the toggle state. Also, they don't have the tint propierty avaliable. You have to make a lot of selectors for each color avaliable in the aspect option, and then setting them for each theme. Then you have to switch the theme in runtime, with:

setTheme(android.R.style.Theme_Dark);

Maybe there's a new toggle button or custom widget that allows you to do this, but I don't know if it exists.

janavarro
  • 869
  • 5
  • 24