Android Wear 2.0 styled switches

2019-02-11 06:26发布

问题:

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 like the new switchs in android wear 2.0 (picture 2). How did google do them?

回答1:

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



回答2:

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

See here: Support Library Wear R.style