celoftis
celoftis

Reputation: 363

TextAppearance in theme

I want to set the text appearance in my theme to be TextAppearnance.Large. Here is what I am doing in my styles.xml (my application is pointing to this theme in my manifest)

<style name="myTheme" parent="android:Theme.NoTitleBar.Fullscreen">  
 <item name="android:textAppearance">@android:style/TextAppearance.Large</item>  
</style>

Problem: My text is still being displayed small.

Question(s):

Upvotes: 6

Views: 23237

Answers (2)

Noumenon
Noumenon

Reputation: 6442

First, declare the attribute as

<item name="android:textAppearance">?android:attr/textAppearanceLarge</item>

But declaring text appearance or text color in a theme only affects text that has absolutely no style or attribute anywhere, including system-defined ones. If you add a

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Medium Text" />

without even the android:textAppearance="?android:attr/textAppearanceMedium" line that Eclipse throws in, it will be affected by this theme, but buttons and the like never will.

Upvotes: 5

tony gil
tony gil

Reputation: 9564

themes and styles are defined in the themes.xml and styles.xml files of the sdk implementations in your environment (distinct ones for different android versions or sdk levels).

search your computer for themes.xml (you will probably find multiple instances of it in the "program files/android" folder on a windows 32-bit machine, for example).

this post explains how to customize these attributes.

you can also set explicit size attributes in your xml layout file, by modifying the TextView tag attributes:

<TextView  
    android:layout_width="fill_parent"  
    android:layout_height="wrap_content"  
    android:text="15sp is the 'normal' size."  
    android:textSize="15sp"  
    />

this post explains how to customize android fonts (including fontType, fontColor, shadow, bold, italic) directly in xml layout file.

Upvotes: -1

Related Questions