line drawable below textview not showing
Asked Answered
M

2

7

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

Maurer answered 18/1, 2013 at 7:30 Comment(3)
see this post for same issueCopra
@Maurer see the solution I have posted.Flin
thanks ρяσѕρєя K works gr8Maurer
F
16

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>
Flin answered 18/1, 2013 at 7:46 Comment(1)
It is only taking some space of the screen. How can we make the shape to take entire space. i.e, "fill_parent"?Giovannagiovanni
D
-3

Use Linkify

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

It will show automatically line below textview

Dietetic answered 18/1, 2013 at 7:35 Comment(4)
Questionnaire asked about having line bottom of the text but not to Linkify textLimelight
Add <View android:layout_width="fill_parent" android:layout_height="1dip" ></View> and give specific colorDietetic
ya i'd rather not use a link. will try out the other optionMaurer
The most sarcastic solution.Pythoness

© 2022 - 2024 — McMap. All rights reserved.