Android Wear 2.0 styled switches

后端 未结 3 773
独厮守ぢ
独厮守ぢ 2021-01-01 07:13

I\'m making a watch face for my android wear watch and in the config activity I want a switch. The switch looks like a usual android switch (picture 1) but I want it to look

相关标签:
3条回答
  • 2021-01-01 07:42

    The switch in picture 2 is a SwitchPreference which is (at least currently) only supported in a PreferenceFragment.

    0 讨论(0)
  • 2021-01-01 07:52

    You can use Widget.Wear.RoundSwitch style to get the round switch style.

    Here is an example:

    <Switch
        style="@style/Widget.Wear.RoundSwitch"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    
    0 讨论(0)
  • 2021-01-01 07:53

    In the latest update we added a RoundSwitch style which should do exactly what you need.

    See here: Support Library Wear R.style

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