public void changePicture(final int champion, final String health,
final String mana, final String armor, final String res,
final String damage, final String ap, final String speed) {
this.finish();
final RelativeLayout test = (RelativeLayout) findViewById(R.id.layoutChamps);
test.removeAllViews();
final RelativeLayout layoutCreate = (RelativeLayout) findViewById(R.id.layoutCreate);
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View createView = layoutInflater.inflate(R.layout.create_build_page, null);
test.addView(createView);
ImageButton champ = (ImageButton) createView.findViewById(R.id.ibChamp);
ImageButton items1 = (ImageButton) createView.findViewById(R.id.ibItem1);
TextView tvItemMana = (TextView) findViewById(R.id.tvItemMana);
tvItemMana.setTextColor(Color.YELLOW);
champ.setImageResource(champion);
}
这样做是打开另一个布局,但是在打开的布局上应用所有文本和图像更改后关闭它,而不是我想要它做什么,然后关闭它然后应用所有更改。