如何使TextView看起来像Setting的PreferenceCategory标题

dan*_*c05 11 android textview android-preferences

这应该是很容易理解的东西,但我无法在任何地方找到答案.

我试图使常规TextView看起来非常相似,在任何应用程序的设置上显示的首选项类别标题.这就是我的意思:

首选项类别标题

现在,我尝试了一些事情,但我似乎没有做对.例如,我尝试设置此:

android:drawableBottom="?android:attr/dividerVertical"
Run Code Online (Sandbox Code Playgroud)

到我的TextView,但似乎根本没有做任何事情,我的TextView仍然是这样的:

图像看起来不正确

我也尝试过设置一个可绘制的:

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
    android:width="1dp"         
    android:color="@android:color/darker_gray"
    />
</shape>
Run Code Online (Sandbox Code Playgroud)

但那也没出现在我的文字上.

这是现在的TextView样式:

 <style name="NewTaskHeaderText">
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_width">match_parent</item>
    <item name="android:textColor">@android:color/holo_blue_dark</item>
    <item name="android:minHeight">48dp</item>
    <item name="android:gravity">center_vertical</item>
    <item name="android:padding">8dp</item>
</style>

<TextView
    android:id="@+id/textView4"
    style="@style/NewTaskHeaderText"
    android:drawableBottom="@android:attr/dividerVertical"
    android:text="@string/some_text"
    android:textAppearance="?android:attr/textAppearanceMedium" />
Run Code Online (Sandbox Code Playgroud)

任何想法,将不胜感激.

Jon*_*Jon 33

<TextView
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:text="foo"
    style="?android:attr/listSeparatorTextViewStyle" />
Run Code Online (Sandbox Code Playgroud)

要做更多,请看这个其他的答案