TextView is added to the screen
<TextView
android:id="@+id/eventDetail_SpecialInfos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="4dp"
android:fontFamily="@font/source_sans_pro"
android:text="Special Info"
android:drawableBottom="@drawable/information_underline"
android:textColor="@color/colorBlack"
android:textSize="14dp" />
information_underline drawable is:
<stroke
android:width="20dp"
android:color="@color/colorBlack" />
Check the @Suraj answer.
An alternative could be to use a TextInputLayout
in the Material Component Library with a OutlinedBox style.
Something like:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
..>
<com.google.android.material.textfield.TextInputEditText
../>
</com.google.android.material.textfield.TextInputLayout>
Drawable you have created is not the right way to do that and use the below code to draw anything in bottom of textview
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<size
android:height="1dp"
android:width="100dp" />
<solid android:color="@android:color/black" />
</shape>
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.