Question

I have a textview i want to show a line below it. I am using the drawableBottom attribute to do this. Here is my code

<TextView
 android:id="@+id/total"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:gravity="right"
 android:text="TextView" 
 android:drawableBottom="@drawable/dividerline"/>

here is my dividerline.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line">

    <stroke
        android:width="70dp"
        android:color="@android:color/black"
        />
    <size
        android:height="1dp"
     />
    <solid
        android:color="@android:color/black"
    />

</shape>

I am not getting errors. Its just that when I run my app no line appears below the textview.

Have a misunderstood drawableBottom attribute? Looking forward to some help:)

Was it helpful?

Solution

Try this :

<?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="70dp" />

    <solid android:color="@android:color/black" />

</shape>

OTHER TIPS

Use Linkify

phone_no.setText("1222446");
Linkify.addLinks(phone_no, Linkify.ALL);

It will show automatically line below textview

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top