Ich suche diese Farbe nur auf alle Schalter anzuwenden. Aber standardmäßig wird colorAccent
anstelle dieses Themas für den Wechsel verwendet.
Ich kann die Farbe des Schalters nicht ändern
Gerät: Marshmallow.
Layout:
<Switch
android:id="@+id/soundSwitch"
style="@style/SwitchStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="@dimen/large_space"
android:layout_marginRight="@dimen/medium_space"
android:layout_marginTop="@dimen/large_space"
android:checked="true"
/>
Arten-v21:
<style name="SwitchStyle" parent="Theme.AppCompat.Light">
<!-- active thumb & track color (30% transparency) -->
<item name="android:colorControlActivated">@color/switch_color</item>
<!-- inactive thumb color -->
<item name="colorSwitchThumbNormal">#f1f1f1</item>
<!-- inactive track color (30% transparency) -->
<item name="android:colorForeground">#42221f1f</item>
</style>
Was mache ich falsch?
, wenn Sie in diesem Kampf und scheitern Sie nur das Überschreiben der colorAccent '- Ihre Farbe
' –
Xenolion