Code example for AbsoluteLayout

Methods: addViewremoveView

0
    Bitmap resizeBmp = Bitmap.createBitmap(bmp,0,0,bmpWidth,bmpHeight,matrix,true); 
      
    if(id==0)
    { 
      /* ¦pªG¬O²Ä¤@¦¸«ö¡A´N²¾°£­ì¨Ó³]©wªºImageView */ 
      layout1.removeView(mImageView);
    } 
    else 
    { 
      /* ¦pªG¤£¬O²Ä¤@¦¸«ö¡A´N²¾°£¤W¤@¦¸©ñ¤jÁY¤p©Ò²£¥ÍªºImageView */ 
      layout1.removeView((ImageView)findViewById(id));
    } 
    /* ²£¥Í·sªºImageView¡A©ñ¤JreSizeªºBitmapª«¥ó¡A¦A©ñ¤JLayout¤¤ */ 
    id++;
    ImageView imageView = new ImageView(EX04_23.this);  
    imageView.setId(id);
    imageView.setImageBitmap(resizeBmp);
    layout1.addView(imageView); 
    setContentView(layout1);
     
    /* ¦]¬°¹Ï¤ù©ñ¨ì³Ì¤j®É©ñ¤j«ö¶s·|disable¡A©Ò¥H¦bÁY¤p®É§â¥L­«³]¬°enable */ 
    mButton02.setEnabled(true);
  }