Reputation:
When I create a new android project,the default Theme is android:Theme.Light, I find the font size of TextView control is small, does it mean the default value of textAppearance in android:theme="@style/AppTheme" is textAppearanceSmall? Thanks!
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
Upvotes: 7
Views: 11594
Reputation: 41510
The TextView
doesn't take the default textAppearance
, it is set to be explicitly to use textAppearanceSmall
by default.
Themes.xml
contains the following line which defines default style for the TextView
:
<item name="textViewStyle">@android:style/Widget.TextView</item>
The referenced style contains the following line:
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
This is why TextView
defaults to small text size.
Upvotes: 8
Reputation: 17986
You can find the styles used for all the Android widgets on the default styles.xml file. You can have a look to this file for example here: https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml
Or directly into your SDK folder, for example on my computer it is available here: D:\Dev\android-sdk\platforms\android-17\data\res\values\styles.xml
You will find in this file the definition of the style for the TextView
:
<style name="Widget.TextView">
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
<item name="android:textSelectHandleLeft">?android:attr/textSelectHandleLeft</item>
<item name="android:textSelectHandleRight">?android:attr/textSelectHandleRight</item>
<item name="android:textSelectHandle">?android:attr/textSelectHandle</item>
<item name="android:textEditPasteWindowLayout">?android:attr/textEditPasteWindowLayout</item>
<item name="android:textEditNoPasteWindowLayout">?android:attr/textEditNoPasteWindowLayout</item>
<item name="android:textEditSidePasteWindowLayout">?android:attr/textEditSidePasteWindowLayout</item>
<item name="android:textEditSideNoPasteWindowLayout">?android:attr/textEditSideNoPasteWindowLayout</item>
<item name="android:textEditSuggestionItemLayout">?android:attr/textEditSuggestionItemLayout</item>
<item name="android:textCursorDrawable">?android:attr/textCursorDrawable</item>
</style>
You can see that indeed in this file the text size is defined with textAppearanceSmall
by default.
Upvotes: 11