里面有关于Android的操作栏将开关里面、操作、Android

由网友(逐风剑客)分享简介:我工作的一个项目,目前我正在试图把应用程序的操作栏里面的开关(如Wi-Fi设置:的 http://tinypic.com/r/2l8vt35/6 )I'm working on a project where I am currently trying to put a switch inside the appli...

我工作的一个项目,目前我正在试图把应用程序的操作栏里面的开关(如Wi-Fi设置:的 http://tinypic.com/r/2l8vt35/6 )

I'm working on a project where I am currently trying to put a switch inside the applications action bar (as in the wi-fi settings : http://tinypic.com/r/2l8vt35/6 )

如何才能做到这一点?

推荐答案

添加安卓actionLayout <项目> 在你的菜单XML资源,指向有你的开关的布局XML资源。然后,使用 getActionView()菜单项来注册监听器在变化开关。

Add android:actionLayout to your <item> in your menu XML resource, pointing to a layout XML resource that has your Switch. Then, use getActionView() on the MenuItem to register listeners on changes in the switch.

注意开关仅适用于API级别14或更高。

Note that Switch only works on API Level 14 and higher.

阅读全文

相关推荐

最新文章