我實現一個SimpleAdapter
喜歡這個列表的類型:的Android SimpleAdapter - 要求更改<Map>
List<Map> data = getDrawerData();
SimpleAdapter adapter = new SimpleAdapter(this, data,R.layout.drawer_list_item,new String[] {"drawer_icon","drawer_text"},new int[] {R.id.drawer_icon, R.id.drawer_text});
然而,2號線給了我這個錯誤:
The constructor SimpleAdapter(MainActivity, List, int, String[], int[]) is undefined
Two fixes
1. Cast argument 'data' to 'List<? extends Map<String, ?>>'
或 2. Change type of 'data' to 'List<? extends Map<String, ?>>'
我選擇了Cast
選項,但這則僅顯示圖標抽屜列表項,而不是他們TextView
標籤...
我跟着這個教程:http://shenhengbin.wordpress.com/2012/03/17/listview-simpleadapter/
通過extendng創建自定義適配器ArrayAdapter –
您是否導入'SimpleAdapter' ...'import android.widget.SimpleAdapter;' – bakriOnFire
'@ Biraj'有沒有辦法可以使用'SimpleAdapter'? – KickAss