Android: How to set drawablePadding programmatically?
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?
You can get refernce of ur text view and then can set
UrTextView.setCompoundDrawablePadding(your padding value);
textView.setCompoundDrwablePadding(takes_only_one_argument_for_all_side_padding);