Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は現在、アプリケーションのアクションバー内にスイッチを配置しようとしているプロジェクトに取り組んでいます(wi-fi設定のように:http://tinypic.com/r/2l8vt35/6)
これはどのように行うことができますか?
メニューのXMLリソースに追加android:actionLayoutし、<item>を含むレイアウトXMLリソースをポイントしますSwitch。次に、を使用getActionView()してMenuItem、スイッチの変更に関するリスナーを登録します。
android:actionLayout
<item>
Switch
getActionView()
MenuItem
SwitchAPIレベル14以降でのみ機能することに注意してください。