mlm mlm - 3 months ago 23
Android Question

Where is Widget.Material.Light.TextView.ListSeparator defined?

I'm working through the book 'Android Programming' (2nd Edition) by the Big Nerd Ranch Guide. Page 152 contains the markup:

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/crime_title_label"
style="?android:listSeparatorTextViewStyle"
/>


In Android Studio, when I click F1 while the cursor is on 'listSeparatorTextViewStyle' it brings up documentation. The first three lines of this documentation are:

android:listSeparatorTextViewStyle
TextView style for list separators.

?android:attr/listSeparatorTextViewStyle => @style/Widget.Material.Light.TextView.ListSeparator


Now when I search for the style Widget.Material.Light.TextView.ListSeparator on the page https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/styles.xml I get no result. Where is the style Widget.Material.Light.TextView.ListSeparator defined?

Answer

It's in the styles_material.xml (found here).

<style name="Widget.Material.TextView.ListSeparator" parent="Widget.TextView.ListSeparator">
    <item name="background">@drawable/list_section_divider_material</item>
    <item name="textAllCaps">true</item>
</style>

<style name="Widget.Material.Light.TextView.ListSeparator" parent="Widget.Material.TextView.ListSeparator"/>

Widget.TextView.ListSeparater is the parent and can be found in the regular styles.xml:

<style name="Widget.TextView.ListSeparator">
    <item name="background">@drawable/dark_header_dither</item>
    <item name="layout_width">match_parent</item>
    <item name="layout_height">wrap_content</item>
    <item name="textStyle">bold</item>
    <item name="textColor">?textColorSecondary</item>
    <item name="textSize">14sp</item>
    <item name="gravity">center_vertical</item>
    <item name="paddingStart">8dip</item>
</style>
Comments