开发者

how to set image on background of button correctly

When I set an icon or an image as a background for a button, I always see something like this :

how to set image on background of button correctly

as you can see, the images are smeared (2 images on left side, and 2 images on right side) Here is the code on how I added the icons(it's the defaults icon from android.R.Drawable...)

btnDown.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.arrow_down_float))开发者_运维问答;
btnUp.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.arrow_up_float));
delete.setBackgroundDrawable(myIcon);
btnOk.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.ic_menu_save));

can someone tell me how to set icon/image on background correctly ? Without them being smeared . if the icon is 32x32, I want see it on button.


may be your image is too small thats why its looking like smeared ...use nine patch scaled image this will help you

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜