Android: How to set drawablePadding programmatically?

android

Solution

You can get refernce of ur text view and then can set

UrTextView.setCompoundDrawablePadding(your padding value);

Problem

Here is my code in xml layout: ``` <TextView android:id="@+id/mail_message_content_field" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Medium Text" android:autoLink="web" android:drawableLeft="@drawable/attachment" android:drawablePadding="10dp" android:gravity="center|left" android:textAppearance="?android:attr/textAppearanceMedium" /> ``` The same way I want to change drawablePadding for drawable programmatically. How to do this?

Original source