目前我正试图在ListView中放置一个MapView.有没有人有这样的成功?甚至有可能吗这是我的代码:
ListView myList = (ListView) findViewById(android.R.id.list);
List> groupData = new ArrayList>();
Map curGroupMap = new HashMap();
groupData.add(curGroupMap);
curGroupMap.put("ICON",R.drawable.back_icon);
curGroupMap.put("NAME","Go Back");
curGroupMap.put("VALUE","By clicking here");
Iterator it = data.entrySet().iterator();
while (it.hasNext())
{
//Get the key name and value for it
Map.Entry pair = (Map.Entry)it.next();
String keyName = (String) pair.getKey();
String value = pair.getValue().toString();
if (value != null)
{
//Add the parents -- aka main categories
curGroupMap = new HashMap();
groupData.add(curGroupMap);
//Push the correct Icon
if (keyName.equalsIgnoreCase("Phone"))
curGroupMap.put("ICON",R.drawable.phone_icon);
else if (keyName.equalsIgnoreCase("Housing"))
curGroupMap.put("ICON",R.drawable.house_icon);
else if (keyName.equalsIgnoreCase("Website"))
curGroupMap.put("ICON",R.drawable.web_icon);
else if (keyName.equalsIgnoreCase("Area Snapshot"))
curGroupMap.put("ICON",R.drawable.camera_icon);
else if (keyName.equalsIgnoreCase("Overview"))
curGroupMap.put("ICON",R.drawable.overview_icon);
else if (keyName.equalsIgnoreCase("Location"))
curGroupMap.put("ICON",R.drawable.map_icon);
else
curGroupMap.put("ICON",R.drawable.icon);
//Pop on the Name and Value
curGroupMap.put("NAME",keyName);
curGroupMap.put("VALUE",value);
}
}
curGroupMap = new HashMap
//Set up adapter
mAdapter = new SimpleAdapter(
mContext,groupData,R.layout.exp_list_parent,new String[] { "ICON","NAME","VALUE" },new int[] { R.id.photoAlbumImg,R.id.rowText1,R.id.rowText2 }
);
myList.setAdapter(mAdapter); //Bind the adapter to the list
在此先感谢您的帮助!!