Mm

1. main.xml ft^WA^A layout1 > : Layoutlnflater inflate = (Layoutlnflater) getSystemService(

Context.LAYOUTINFLATERSERVICE); layout1 = (LinearLayout)inflate.inflate(R.layout.main, null, null);

layout2 = (LinearLayout)inflateinflate(R.layoutiis?, null, null);

@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case CHGID:

selection = ! selection; if(selection) setContentView(layout 1); else setContentView(layout2); //

Layoutlnflater inflate = (Layoutlnflater) getSystemService(

Context.LAYOUTINFLATERSERVICE); layout1 = (LinearLayout)inflate.inflate(R.layout.rnain, null, null); setContentView(layout1);

A^ffl^JA setContentView(R.layout.main) °

0 0

Post a comment