Reputation: 2655
Is it possible to set drawableLeft outsite the TextViews 9patch background?
i'm using this code:
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background_9patch"
android:drawableLeft="@drawable/leftImg"
android:text="Hello World" />
and I want that android:drawableLeft="@drawable/leftImg" will be at the left of the android:background="@drawable/background_9patch" .
Upvotes: 3
Views: 441
Reputation: 63303
Since your background is a custom 9-patch, you could just modify the background image to have a fixed-size transparent section on the left side of the stretchable content, which provides enough padding for the left Drawable
. This is how the framework creates backgrounds for widgets like CheckBox
that shift the text to be beside the corresponding button.
Upvotes: 2