この色はすべてのスイッチにのみ適用します。しかし、デフォルトではスイッチのテーマではなく、colorAccent
となっています。
スイッチの色を変更できません
デバイス:marshmallow。
レイアウト:
<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"
/>
スタイル-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>
私が間違っているのか?
あなたはその中で苦労して失敗した場合、あなただけのcolorAccent '<項目名=「colorAccent」>をオーバーライドすることで、短い代替を得ることができ、あなたの色' – Xenolion