line drawable below textview not showing

arjukhan picture arjukhan · Jan 18, 2013 · Viewed 8.4k times · Source

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:)

Answer

Pratik Sharma picture Pratik Sharma · Jan 18, 2013

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>