-1

how I can achieve one thing as in the example TextView with a line after the text

Example

Abd Alah
  • 15
  • 4

3 Answers3

0

for adding line check this.

and align this view to the rightOf your text view. done

Community
  • 1
  • 1
Nilesh Deokar
  • 2,975
  • 30
  • 53
0

Try this way this worked for me

 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

   <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="3dp"
      android:text="Heelloos"
      android:layout_marginLeft="10dp"/>

   <View
      android:layout_width="150dp"
      android:layout_height="1dp"
      android:layout_gravity="bottom"
      android:background="#ff00ff"/>

 </LinearLayout>

OUTPUT

enter image description here

Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
Aditya Vyas-Lakhan
  • 13,409
  • 16
  • 61
  • 96
0

Try with this answer:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:text="Your Message: "
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <View
        android:layout_width="150dp"
        android:layout_height="1dp"
        android:layout_alignBottom="@+id/textView"
        android:layout_gravity="bottom"
        android:layout_toEndOf="@+id/textView"
        android:layout_toRightOf="@+id/textView"
        android:background="#FF0000FF" />

</RelativeLayout>
Dhruv
  • 1,801
  • 1
  • 15
  • 27