使用 Android 4.0 风格的切换按钮 [英] Use Android 4.0 styled toggle-button

查看:23
本文介绍了使用 Android 4.0 风格的切换按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做什么

我试图在我的布局中使用 Android 4.0 样式的切换按钮.为此,我选择了 Theme = Theme.Holo.Light .当我从那里取出切换按钮时,它是带有绿线的方块,如果按钮已启用.

I'm trying to use in my Layout the Android 4.0 styled togglebutton. For this I selected the Theme = Theme.Holo.Light . When I take the togglebutton from there its that square with the green line, if the button is enabled.

但我想使用切换按钮,就像他们在顶部的配置中一样(看看打印屏幕).

But I'd like to use the togglebutton like they got in there config on top (take a look at the printscreen).

问题

我如何使用这个切换按钮?一些代码片段或快速教程会很棒!

How can I use thise togglebutton? Some Codesnippets or a quick tutorial would be great!

最好的问候

野生动物园

图片

推荐答案

新我现在对切换回 API 级别 8 进行了完整的向后移植,并将其放在 github 上:https://github.com/ankri/SwitchCompatLibrary

New I now did a full backport of the Switch back to API Level 8 and put in on github: https://github.com/ankri/SwitchCompatLibrary

带有我自定义 Switch 实现的旧帖子:

The old post with my custom implementation of the Switch:

我参加聚会有点晚了,但我遇到了同样的问题.我从这个 thred 的另一篇文章中获取了源代码,并制作了我自己的 switch 版本.

I'm a bit late to the party but I had the same problem. I took the source code from the other post in this thred and made my own version of the switch.

您可以在在我的网站上找到源代码和文档

这是它的样子:

更新链接和图片

这篇关于使用 Android 4.0 风格的切换按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆