-
Notifications
You must be signed in to change notification settings - Fork 24k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Styling the active SwitchAndroid color? #2903
Comments
We don't expose a way to customize it from JS at the moment. You can use custom android theme for your app and customize a way how switch should look there as you'd do in the native android app. |
Is there a plan to add onTintColor for Android in near future? |
+1 |
Why is this issue closed? Aren't there any plans for this? |
That default teal color is not so great; is there still no way to customize it from react native without doing something in java? |
I think this still isn't possible. |
So how would one exactly do this with a React Native android app? For Example - I want the switch color to be blue, is there a comprehensive guide I can follow? |
I've managed to changed to whole app accent color, however is there a way to change just the switch accent color? For me this does not work in styles.xml:
Only when I change the whole app accent color on theme editor, the switch changes. |
And this is still very much an issue, why is this closed? |
My styles.xml in android/res/values
This in android native code will make all controls (checkboxes and radio buttons as well) |
I solved this changing the XML in <resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowBackground">@color/darkBlue</item>
<item name="colorPrimary">@color/darkBlue</item>
<item name="colorPrimaryDark">@color/darkBlue</item>
<item name="colorAccent">@color/brightBlue</item> <!-- this makes the trick -->
</style>
</resources> |
On Android, it's not possible to change the ripple color to match the thumb color. Isn't this correct? Also is there ability to chagne size? I used transform scale but the layout of course doesn't respect that scaled size. |
Why is this issue closed? Clearly seems like something that should be possible. |
@MrLoh we can change colors with |
@fabriziomoscon's solution worked for me. However, keep in mind that changing the value of "colorAccent" will change the color accent default for your whole app, so you may have to go in and make some changes to the TextInput and other elements affected by the colorAccent. It hasn't been mentioned all ready, so I figure I'll save anybody else who is using this solution some time:
|
This appears to be solved with #11940 |
Is it possible to style the color of a SwitchAndroid? I can change the backgroundColor but not the active color
The text was updated successfully, but these errors were encountered: