3

我有一个带有分隔符的列表视图,对于我使用这个 xml 的标题:

<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/list_header_title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingTop="2dip"
    android:paddingBottom="2dip"
    android:paddingLeft="5dip"
    android:textSize="20sp"
    style="?android:attr/listSeparatorTextViewStyle" />

通过使用listSeparatorTextViewStyle默认颜色为灰色,我如何更改该颜色或添加图像?

4

1 回答 1

0

You'll need to create your own style.

The Android Source code is a best friend for quickly gathering and building system styled themes.

Follow this path from the source code you've downloaded via Android SDK Manager

platforms/android-19/data/res/values

You'll find something like this inside styles.xml:

For Dark theme:

<style name="Widget.Holo.TextView.ListSeparator" parent="Widget.TextView.ListSeparator">
    <item name="android:background">@android:drawable/list_section_divider_holo_dark</item>
    <item name="android:textAllCaps">true</item>
</style>

For Light theme

<style name="Widget.Holo.Light.TextView.ListSeparator" parent="Widget.TextView.ListSeparator">
    <item name="android:background">@android:drawable/list_section_divider_holo_light</item>
    <item name="android:textAllCaps">true</item>
</style>

By following the path the code mentioned above, you'll get all the assets/images you need to build your own one.

于 2014-03-24T21:54:37.957 回答