使用 listSeparatorTextStyleView 时的不同文本样式

Different text style while using listSeparatorTextStyleView

我想在我的 .xml 文件中使用列表分隔符,但每次我这样做时,文本样式都会发生变化,变得更大更粗。

以下是 link 的屏幕截图。左边的图片是我的代码显示出来的,右边的是我真正想要的。

Picture for output

我只想知道如何让文字不再变大加粗,同时如何在<TextView>.

下面加一条横线

下面是代码link

Code

对于水平线,您可以使用此代码:

<TextView
    android:id="@+id/tevi_divide"
    android:layout_width="match_parent"
    android:layout_height="0.5dp"
    android:layout_margin="3dp"
    android:background="@color/detail_line_divider"
    android:text="@string/str_empty" />

你把这个放在你的文本视图下面。您可以根据需要更改高度和边距的值。

根据@John Kalimeris 的回答,我有一个更好的方法,不需要外部资源。这应该适合你。

<TextView
        android:layout_width="match_parent"
        android:layout_height="5dp"
        style="?android:attr/listSeparatorTextViewStyle"
        android:layout_marginBottom="3dp"/>