[問題] 在mapview上新增很多自己寫的layout
因為想在mapview上新增很多balloon對話框
然後自己也畫了一個balloon的layout
但是使用for迴圈新增後
顯然是不行的
因為system err會叫我要removeView()
所以這樣明顯只能用一個
有甚麼好方法呢??
for(int i=0;i<c.getCount();i++){
id[i] = String.valueOf(c.getInt(0)); //以下是撈資料
name[i] = c.getString(5);
latitude[i] = c.getString(6);
longitude[i] = c.getString(7);//以上是撈資料
double lat =Double.parseDouble(latitude[i])*1E6;
double lon =Double.parseDouble(longitude[i])*1E6;
GeoPoint gp = new GeoPoint((int)lat,(int)lon);
bubblelayout noteBaloon = (bubblelayout) layoutInflater.inflate(
.layout.overlay_bubble, null);//修改處
((TextView) noteBaloon.findViewById(R.id.note_label)).setText(name[i]);
mMapView.addView(noteBaloon, new MapView.LayoutParams(280, 100, gp,
MapView.LayoutParams.BOTTOM_CENTER));
mMapView.setEnabled(true);
c.moveToNext();
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.224.48.94
→
08/13 07:07, , 1F
08/13 07:07, 1F
→
08/13 07:08, , 2F
08/13 07:08, 2F
→
08/13 07:09, , 3F
08/13 07:09, 3F
→
08/13 07:10, , 4F
08/13 07:10, 4F
→
08/13 07:12, , 5F
08/13 07:12, 5F
→
08/13 12:14, , 6F
08/13 12:14, 6F
推
08/13 14:03, , 7F
08/13 14:03, 7F
※ 編輯: oralB 來自: 61.224.48.94 (08/13 14:36)
→
08/13 14:37, , 8F
08/13 14:37, 8F
→
08/13 14:38, , 9F
08/13 14:38, 9F
※ 編輯: oralB 來自: 61.224.48.94 (08/13 14:40)
→
08/13 14:41, , 10F
08/13 14:41, 10F
→
08/13 14:41, , 11F
08/13 14:41, 11F
AndroidDev 近期熱門文章
PTT數位生活區 即時熱門文章