[問題] imageview如何控制縮小?
放置一張imageview,把它設置背景為全白的圖
請問要如何點擊它並把它等比例縮小呢?
例如:點一下 1 >0.8 >0.6>0.4>> 再回到1
Image11.setOnClickListener(this);
public void onClick(View v) {
Image11.buildDrawingCache();
Bitmap bmp = Image11.getDrawingCache();
int width = bmp.getWidth();
int height = bmp.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(0.8f,0.8f);
// 得到新的圖片
Bitmap newbm = Bitmap.createBitmap(bmp, 0, 0, width, height,
matrix, true);
//重新載入 imageView
Image11.setImageBitmap(newbm);
}
可以執行但是點擊image的時候不會變小Q.Q
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.123.115.137
※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1461817091.A.BC7.html
推
04/28 16:42, , 1F
04/28 16:42, 1F
→
04/28 17:04, , 2F
04/28 17:04, 2F
→
04/28 17:36, , 3F
04/28 17:36, 3F
→
04/28 17:36, , 4F
04/28 17:36, 4F
推
05/03 11:59, , 5F
05/03 11:59, 5F