2013-02-11 48 views
7

我想调整我的ImageButton使用鼠标在图形布局或使用代码 android:layout_width,android:layout_height。但是,每当我这样做,ImageButton没有调整大小,事实上,它不是更小,但它被削减的边缘。如何调整imageButton?

在此先感谢

回答

11

首先尝试使用安卓背景代替机器人:SRC设置在button.In大多数情况下的图像,它helps.If没有,那么看到这些..

+0

谢谢,它适用于android:背景 – 2013-02-17 10:15:31

+0

很高兴帮助你:) – ridoy 2013-02-17 19:23:35

1

这可能是图像大小的问题。尝试使用调整大小的图像,然后在图像按钮中使用它。然后可以设置按钮的宽度和高度。

2

您将不得不指定固定尺寸的按钮(使用dp而不是px)。例如:

<ImageButton 
    android:background="@drawable/ic_menu_more" 
    android:layout_width="50dip" 
    android:layout_height="50dip" 
/>