Robby Smet
Robby Smet

Reputation: 4661

Android built in drawable doesn't scale

I have a problem with a drawable. I working on a layout for a tablet, but the drawable doesn't scale.

This is what it looks like:

enter image description here

The problem is the delete drawable in the top right. I used the built in drawable ic_input_delete.

Here is the xml of the edittext and imagebutton:

 <LinearLayout
    android:id="@+id/inputLayout"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_marginBottom="5dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="8dp"
    android:layout_weight="0.2"
    android:background="@android:drawable/edit_text"
    android:gravity="center_vertical"
    android:orientation="horizontal" >

    <EditText
        android:id="@+id/pinDisplay"
        android:layout_width="0dip"
        android:layout_height="fill_parent"
        android:layout_weight="0.85"
        android:background="@null"
        android:hint="@string/pincode_hint"
        android:padding="3dp"
        android:textSize="24sp" />

    <ImageButton
        android:id="@+id/backspace"
        style="@android:style/Widget.Button"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_gravity="center_vertical"
        android:layout_margin="3dp"
        android:layout_weight="0.15"
        android:gravity="center"
        android:src="@android:drawable/ic_input_delete" />
</LinearLayout>

How can I fix this ?

Upvotes: 0

Views: 736

Answers (1)

jsmith
jsmith

Reputation: 4897

Try setting the android:scaleType to FIT_XY or CENTER_INSIDE:

http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

Upvotes: 2

Related Questions