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 :
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
精彩评论