close
Toolbar可以當action用
上面的功能內容使用menu來實踐
介紹如下
1. 官網http://developer.android.com/training/appbar/actions.html#add-actions
內有提到要下載icon可以到https://design.google.com/icons/
menu的屬性可以參考http://developer.android.com/guide/topics/resources/menu-resource.html
2. 在res內建立menu資料夾, 並放置xml檔
3. 在menu.xml內參考官網建立menu
4. 使用上則在onCreateOptionMenu上載入meun
5. 在onOptionsItemSelected建立callback
6. 用Item.getItemId()來取得上面的選項
7. 最後執行後就可以看到action的選項了
文章標籤
全站熱搜