0
在我看來,碎片的替換方法不適用於列表碎片。此代碼給我一個錯誤:安卓在導航抽屜中顯示listFragment
mFragmentManager.beginTransaction().replace(R.id.content_frame, mFragment).commit();
如何在導航抽屜中顯示列表片段?有沒有其他方法?
我收到的錯誤是:
The method replace(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, ListFragment)
它說,這是不適用的。當我只將列表片段類更改爲片段時,我的問題是我無法將列表視圖的適配器也設置爲setListAdapter。有人能幫助我嗎?
當您因爲錯誤而詢問某些編程問題時,首先要做的是告訴您收到的錯誤。複製整個錯誤是你可以做的最好的。 – 2014-10-20 18:52:04
你好,謝謝你的回答。我更新了我的問題。 :) – LavG 2014-10-20 18:59:16
'mFragment'是一個'Fragment',你必須使用'ListFragment'作爲參數。 – 2014-10-20 19:11:23