0
我想更改「RelativeLayout」的內容,問題是該佈局的內容在另一個XML中。從另一個XML加載佈局
setContentView(R.layout.activity_fullscreen);
//from actual xml
RelativeLayout rL1= (RelativeLayout) findViewById(R.id.principalLayout);
//from another xml
RelativeLayout rL2= (RelativeLayout) findViewById(R.id.cocinaL);
rL1.removeAllViews();
rL1.addView(rL2); //this fail because rL2 is null
感謝