我想在我的按钮(添加dyncamilly)中添加图像背景,但默认情况下图像原始大小看起来应用了,而且它太大了。如何自动调整图像以适应按钮大小?
Drawable img = act.getResources().getDrawable(R.drawable.top);
button.setBackground(img);
答案 0 :(得分:1)
使用ImageButton http://developer.android.com/reference/android/widget/ImageButton.html
他们应该自动处理大小调整
答案 1 :(得分:0)
在Button xml中,尝试添加此
android:scaleType="fitCenter"