简体   繁体   中英

Android Stroke Shape Drawable Left for TextView

Following is my drawable xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
    android:width="1dp"
    android:color="@color/button_blue" />

Following is textView xml

                    <TextView
                    android:id="@+id/tvOrigin"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="5dp"
                    android:drawableLeft="@drawable/circle_cab"
                    android:drawablePadding="16dp"
                    android:drawableTint="@color/deal_disc_bg"
                    android:ellipsize="end"
                    android:lineSpacingExtra="2sp"
                    android:maxLines="1"
                    android:paddingBottom="10dp"
                    android:paddingTop="10dp"
                    android:text="ksjkdjksjkdjkj"
                    android:textSize="14sp" />

I found that drawable is not appearing on left side of textview

Then I have added following to drawable xml

   <size
    android:width="10dp"
    android:height="10dp" />

After adding this line I a getting drawable in left but it is drawing solid circle and not stroke

Any idea how to add stroke circle as drawable left to textview only through XML and not pragmatically.

在此处输入图片说明

I think that all circle it is a stroke. what I Mean that you width of stroke is exactly the size (consider left stroke 1 and right stroke 1) to fix it try to increase the size or decrease the width of the stork.

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
    android:width="0.5dp"
    android:color="@color/button_blue" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM