I have a text view with icon rendered in the TextView. It has an image. I have set on the left of the text. But I need to set the icon as a circular shape.
How can I design this in java?
My code which set on the left side.
textview.setCompoundDrawablesWithIntrinsicBounds(
image, 0, 0, 0);
How can I design the circular image for the above textview drawableleft image.
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:ellipsize="end"
android:layout_marginTop="5dp"
android:layout_marginBottom="-10dp"
android:gravity="center"
android:layout_marginLeft="15dp"
android:minHeight="24dp"
android:paddingLeft="@dimen/spacing_d2"
android:paddingRight="@dimen/spacing_d2"
android:tag="@string/tag_font_h_regular"
android:fontFamily="@font/cachetbook"
android:textColor="@color/white_new"
android:textSize="12dp"
tools:text="Universal Orlando Resort"/>
from How to design drawable left icon as circular (added using setCompoundDrawablesWithIntrinsicBounds) in Textview using java code (not xml)
No comments:
Post a Comment