Add toggle button to the menu to stop and start service

后端 未结 6 828
抹茶落季
抹茶落季 2020-12-11 03:24

I am trying to enable the user to stops and starts service which I am implementing from the Menu where the text is will be changed when he clicks it so I want to add T

6条回答
  •  旧时难觅i
    2020-12-11 03:54

    You cannot put any widget in

    and expect it to work. What you can put there is documented here and it's basically limited to menu and . No buttons, toggles and other widgets are supported. If that would be sufficient you can use android:checkable on the or use old-skool approach and alter menu item depending on the state (if service is on, then your item should read turn service off and vice versa).

提交回复
热议问题