Java 如何在Android中调整位图图像的大小
我在XML中尝试了border属性,但是图像没有调整大小 如何调整位图图像的大小 Vielen dank im voraus.使用可以帮助您。这样使用:Java 如何在Android中调整位图图像的大小,java,android,textview,android-bitmap,Java,Android,Textview,Android Bitmap,我在XML中尝试了border属性,但是图像没有调整大小 如何调整位图图像的大小 Vielen dank im voraus.使用可以帮助您。这样使用: TextView aboutBags = new TextView( mContext ); aboutBags.setText("Compose"); aboutBags.setTextAppearance( R.style.RevStyleHelpAbout ); aboutBags.setBackgroundResource( R.dra
TextView aboutBags = new TextView( mContext );
aboutBags.setText("Compose");
aboutBags.setTextAppearance( R.style.RevStyleHelpAbout );
aboutBags.setBackgroundResource( R.drawable.rev_item_h_border_left );
Bitmap nameYourBitmap;
Bitmap resized = Bitmap.createScaledBitmap(nameYourBitmap, newWidth, newHeight, true);
您也可以这样做:
TextView aboutBags = new TextView( mContext );
aboutBags.setText("Compose");
aboutBags.setTextAppearance( R.style.RevStyleHelpAbout );
aboutBags.setBackgroundResource( R.drawable.rev_item_h_border_left );
Bitmap nameYourBitmap;
Bitmap resized = Bitmap.createScaledBitmap(nameYourBitmap, newWidth, newHeight, true);
请参阅:
对于XML,scale属性是为SCALEDRAWABLE定义的,它们可以缩放另一个可绘制文件。请访问此开发者网站:感谢您的回复@Animesh Patra。我可以在XML中完成吗?欢迎您。如果我的回答有帮助的话,你可以接受它以备将来参考。