Change gravity of image drawable in textview

Usman Ghauri picture Usman Ghauri · Feb 27, 2017 · Viewed 11.5k times · Source

I've added image Drawable start in a TextView . Problem is i cant control the gravity of that Drawable in TextView

What i need to achieve What i need to achieve

What i have achieved so far

What i have achieved so far

This is my TextView

        <TextView
            android:id="@+id/tv_8_digit_check"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:drawablePadding="@dimen/dimen_4"
            android:drawableStart="@drawable/ic_validate"
            android:text="@string/at_least_8_characters_txt"
            android:textColor="@color/white_trans"
            android:textSize="12sp" />

Any suggestion on how can i set gravity of that Drawable to top/start? Thanks

Answer

Jinal Patel picture Jinal Patel · Feb 27, 2017

Use checkbox instead of textview Drawable, and add custom drawable where you can use this image