开/关切换按钮在preferences和放大器;行动吧 - 冰淇淋三明治风格 [英] On/Off Toggle Button in Preferences & Action Bar - Ice Cream Sandwich Style

查看:104
本文介绍了开/关切换按钮在preferences和放大器;行动吧 - 冰淇淋三明治风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我指的是蓝色的ON / OFF造型如在ICS手机默认的Andr​​oid设置应用程序可见。它也可以在这里看到:<一href="http://android-developers.blogspot.com/2012/02/android-design-v2-now-with-stencils.html">http://android-developers.blogspot.com/2012/02/android-design-v2-now-with-stencils.html 我希望把它们放在一个preference屏幕上,我将不得不使用一个自定义的preference插件?

I am referring to the blue ON/OFF styling as seen in the default Android Settings app on ICS phones. It can also be seen here: http://android-developers.blogspot.com/2012/02/android-design-v2-now-with-stencils.html I want to put them in a Preference screen, would I have to use a custom preference widget?

此外,它是容易把开关按钮的操作栏?这似乎是可能的,因为它是为WiFi设置在默认的ICS Android设置完成,但它可能是一个自定义菜单项?

Also, is it easy to put toggle buttons in the Action Bar? It seems to be possible since it is done for Wifi Settings in the default Android Settings on ICS, but it is probably a custom menu item?

任何帮助是极大的AP preciated。

Any help is greatly appreciated.

推荐答案

一样简单:
我的 XML-V14 / preferences.xml

As easy as:
My xml-v14/preferences.xml

<SwitchPreference
    android:key="@string/feature_id"
    android:title="@string/feature_title" />

有关兼容性:
我的 XML / preferences.xml

For compatibility:
My xml/preferences.xml

<CheckBoxPreference 
    android:key="@string/feature_id"
    android:title="@string/feature_title" />

这篇关于开/关切换按钮在preferences和放大器;行动吧 - 冰淇淋三明治风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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