user1940676
user1940676

Reputation: 4448

reduce the spacing between the drawable and the text

How can I reduce the spacing between the DrawableLeft and the text in a TextView

I can use setting drawablePadding to 0 didn't help.

    <TextView
        android:id="@+id/item"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/small_bg"
        android:drawableLeft="@drawable/mypic"
        android:padding="4dp"
        android:text="25"
        android:gravity="center"
        android:textColor="@android:color/white"
        android:textSize="20sp" />

Upvotes: 1

Views: 2838

Answers (2)

Ekim Kano
Ekim Kano

Reputation: 141

set drawablePadding to a negative value

android:drawablePadding="-8dp"

Upvotes: 4

Saf
Saf

Reputation: 227

You already set the padding for the TextView to 4dp try this:

android:paddingLeft="0dp"
android:paddingRight="4dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"

instead of:

android:padding="4dp"

Upvotes: 1

Related Questions