ICS有一个开关元件。它做什么我们所需要的。有什么在那里向后兼容(约)2.2?找不到什么明显的。
ICS has a Switch component. It does what we need. Is there anything out there backward compatible to (about) 2.2? Couldn't find anything obvious.
看起来像有人建这样的:
Looks like somebody built this:
https://github.com/Prototik/KFramework-SW.git
切换仅在4.0 +
。首先在布局V14将在什么对ICS的设备上使用。在您的布局文件夹中使用CheckBox的。
If you want to make an app that uses switch on 4.0+ devices what you need to do is declare two layouts. The first in layout-v14 which will be what's used on ICS devices. In your layout folder make use of CheckBox.
在你的code利用CompoundButton类获取/设置的开关或复选框数据时。你会发现,CompoundButton很适合这一点。
In your code make use of the CompoundButton class when getting/setting data from the switch or checkbox. You'll find that CompoundButton works well for this.