Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to inhrit style="?android:listSeparatorTextViewStyle" style and change the line color to blue?

I want to have a line below a text view with a blue color I came across this post in this post having this as a one of the answer I tried it and is working fine but I want to change the color of the textview and the line below it.

just add this style:

style="?android:listSeparatorTextViewStyle"

to your TextView

I also have tried extracting the style but it is giving me error while inheriting the said style

My style is as follows

<style name="blueBoldText" parent="?android:listSeparatorTextViewStyle">
    <item name="android:textColor">@color/DarkTurquoise</item>
    <item name="android:textStyle">bold</item>
</style>
like image 609
Chaitanya K Avatar asked Oct 26 '13 08:10

Chaitanya K


2 Answers

Actually, the value of the attribute

?android:listSeparatorTextViewStyle

is

@android:style/Widget.Holo.Light.TextView.ListSeparator

So you can inherit this style instead.

like image 185
Son Huy TRAN Avatar answered Oct 13 '22 05:10

Son Huy TRAN


You can extend TextView and set listSeparatorTextViewStyle.

public class HeaderView extends TextView {
    public HeaderView(Context context) {
        super(context, null, android.R.attr.listSeparatorTextViewStyle);
    }
    public HeaderView(Context context,
                    AttributeSet attrs) {
        super(context, attrs, android.R.attr.listSeparatorTextViewStyle);
    }
}

then

<com.gmail.sikambr.alib.HeaderView
    style="@style/your_style"
    android:text="..."
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
like image 36
Sikambr Avatar answered Oct 13 '22 05:10

Sikambr