2011-05-18 94 views
0

当我设置按钮的背景下,我总是看到一些图标,这个图片: enter image description here如何设置按钮的背景图片corectly

你可以看到:图像有污点(在左侧2个图像, 2个图像的右侧) 这里代码是如何从即时添加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)); 

有人可以告诉我如何在背景设置图标/图像corectly?没有smeaered。如果icond 32×32 - 我想看到它的按钮(

+0

它能够更好地使用的ImageButton – ingsaurabh 2011-05-18 08:32:07

回答

1

可能是你的图像太小所以它看起来像涂抹......用9个补丁缩放图像this will help you

+0

默认的图标从机器人(android.r.drawable)不在9patch? – Peter 2011-05-18 08:40:42

+0

尝试调整你的图像 – Kakey 2011-05-18 08:45:01

+0

我认为只有9patch可以帮助我 – Peter 2011-05-18 08:58:18