3
我有以下代碼:Android的MapView類嘗試添加視圖,但已經有家長
setContentView(R.layout.maplayout);
// Create Rotate view
mRotateView = new RotateView(this);
// create a map view
mapView = (MapView) findViewById(R.id.mapview);
mRotateView.addView(mapView); // error here
setContentView(mRotateView);
mylocation = new MyLocationOverlay(this,mapView);
但是,當我加的觀點,我得到的是說,指定的子已經有母的錯誤。我認爲這是因爲mapView已經是佈局的一個孩子。
那麼,我該如何解決這個問題呢?