Android强调整个textView

use*_*350 1 android textview

是否可以为整个textView(layout_width = fill_parent)加下划线而不仅仅是文本?编辑:TextView的文本应该像一种标题.所以我在标题下面有这个标题和文字.为了清楚地分开这两个部分,我想在标题正下方有一条线,它穿过布局的整个宽度.当header-textView的宽度设置为fill_parent时,整个textView应加下划线而不仅仅是其文本.

问候

Ste*_*e M 6

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Activity A" />
    <View
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="#000" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是一个更好的标题方式:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="@+android:id/title"
        style="?android:attr/listSeparatorTextViewStyle"
        android:text="Units" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)