【发布时间】:2014-08-25 07:48:51
【问题描述】:
我正在使用android:drawableLeft 将drawable 放在按钮上,但是变成了这样:
如何用按钮的高度match height of drawable?
如您所见,我收到的是space on top and bottom,但我的 Facebook 图标是 want to fill this space。
看看我在用什么:
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="5dp" >
<Button
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@drawable/fb_bg"
android:text="Login with Facebook"
android:drawableLeft="@drawable/fb_icon"
android:layout_marginBottom="5dp"
android:drawablePadding="0dp"
android:textColor="@android:color/background_light"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
fb_icon 和 fb_bg(drawables 的大小相同 - 40 x 40)
【问题讨论】:
-
要么使用相同大小的图像,要么删除
android:layout_marginBottom="5dp"以及线性布局的填充
标签: android button android-widget android-xml