Android SwitchCompat style

前端 未结 1 699
忘掉有多难
忘掉有多难 2021-01-20 06:26

I tested my app on my new device with android 5.1.1. In my SettingsActivity i have a switch. I already read some posts and changed it to android.support.v7.widget.Swit

相关标签:
1条回答
  • 2021-01-20 06:48

    Using SwitchCompat.setSwitchTextAppearance you can set the style for the text that appears inside the switch itself.

    Add a style something like this and set it using setSwitchTextAppearance:

    <style name="SwitchTextAppearance" parent="TextAppearance.AppCompat.Widget.Switch">
      <item name="android:textSize">12sp</item>
      <item name="android:textColor">#3F51B5</item>
    </style>
    

    And you should be able to customize the size, color, etc of your "OFF" text.

    0 讨论(0)
提交回复
热议问题