簡體   English   中英

如何將菜單項與列表視圖綁定

[英]How to Bind menu item with listview

在此處輸入圖像描述

問題 - 當用戶單擊菜單刷新按鈕時(如圖所示),歌曲列表將被更新(如果發生任何變化)。 如何實現這一點(任何幫助)

override fun onOptionsItemSelected(item: MenuItem): Boolean {
        return when (item.itemId) {
            R.id.action_refresh -> {
                refreshList()
                true
            }
            else -> super.onOptionsItemSelected(item)
        }
    }

private fun refreshList() {
    // Use this method to load the songs just like you might be using the same in OnCreate currently
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM