I am using android:drawableLeft
to put drawable on button, but getting like this:
How to match height of drawable
with Button's height ?
As you can see i am getting space on top and bottom
, but i want to fill this space
by my facebook icon.
see what i am using:
<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
and fb_bg
( size of both the drawables
are same - 40 x 40
)
Remove padding of parent and margin of Button
Use this
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.