Android - how to compress or downsize an image?

前端 未结 3 1014
攒了一身酷
攒了一身酷 2021-01-14 01:03
ImageButton avatarButton = (ImageButton) findViewById(R.id.ImageButton_Avatar);
avatarButton.setImageResource(R.drawable.avatar);
strAvatarFilename =  \"Image.jpg\";         


        
3条回答
  •  耶瑟儿~
    2021-01-14 01:14

    You can mess with the ImageButton's scaleType properties (to fitXY for example, or cropCenter), and by setting a fixed size to LayoutPreferences (height and width) you'll be all set.

提交回复
热议问题