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

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

问题描述

我想做什么

我想在我的布局使用了Android 4.0风格的切换按钮。为此,我选择的主题= 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.

不过,我想使用切换按钮像他们在那里的配置之上得到了(看看在PRINTSCREEN)。

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

问题

我如何使用thise切换按钮?有些codesnippets或快速教程将是巨大的!

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

最好的问候

野生动物园

图片

推荐答案

新的编辑:我现在做了交换机的全向移植回API 8级,并把在GitHub上: <一href="https://github.com/ankri/SwitchCompatLibrary">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

旧后与我的自定义实现开关的:

The old post with my custom implementation of the Switch:

我迟到了一点,但我有同样的问题。我把源$ C ​​$ c从其他职位在这个thred,并提出我自己的版本的开关。

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.

您可以找到源头code和文档在我的网站

You can find the source code and documentation on my website

这是什么样子的:

编辑:更新的链接和图片

edit: Updated link and picture

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

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