2016-08-24 96 views
0

我正在閱讀Big Nerd Ranch Guide中的「Android Programming」(第二版)一書。第152頁包含的標記:Widget.Material.Light.TextView.ListSeparator在哪裏定義?

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

在Android Studio中,當我點擊F1,同時光標在「listSeparatorTextViewStyle」它帶來了文檔。前三行本文檔的是:

android:listSeparatorTextViewStyle 
TextView style for list separators. 

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

現在,當我搜索風格Widget.Material.Light.TextView.ListSeparator https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/styles.xml在頁面上我沒有得到任何結果。 Widget.Material.Light.TextView.ListSeparator定義的樣式在哪裏?

回答

1

它位於styles_material.xml(找到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是家長,可以在常規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>