[英]How to fill top and bottom space using android:drawableLeft inside Button
我正在使用android:drawableLeft
来将drawable放在按钮上,但是像这样:
如何将match height of drawable
的高度与Button的高度match height of drawable
?
如您所见,我space on top and bottom
都有space on top and bottom
,但是我want to fill this space
用我的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
)
删除父级的填充和Button
边距
用这个
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<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:drawablePadding="0dp"
android:textColor="@android:color/background_light"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.