I am using HoloEverywhere library in my application and for applying typeface from theme I have added a new custom attribute ttfName to TextView style, and have made some necessary changes in constructor of org.holoeverywhere.widget.TextView as follows;
if (a.hasValue(R.styleable.TextView_ttfName)) {
setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/" +
a.getString(R.styleable.TextView_ttfName)));
}
also, the declared style and themes are as follows;
<style name="AppTheme" parent="@style/Holo.Theme.Light.DarkActionBar">
<item name="android:textViewStyle">@style/Widget.ApplicationTheme.TextView</item
</style>
<style name="Widget.ApplicationTheme.TextView" parent="@style/Holo.TextView">
<item name="ttfName">@string/app_font_roboto_light</item>
<item name="android:textSize">@dimen/app_dimen_default_text_size</item>
</style>
and the added ttfName
attribute is as follows;
...
<attr name="ttfName" format="string" />
...
...
<declare-styleable name="TextView">
<attr name="android:text" />
<attr name="android:textAllCaps" />
<attr name="textAllCaps" />
<attr name="ttfName" />
</declare-styleable>
...
now, when I apply a AppTheme to my application the font is getting applied only if android version > 4.0 (haven't checked on 3.0). but on android version 2.3 the font is not getting applied..
Could anybody please help me to figure out what is going wrong here?
Thanks in advance.
it is the typeface which will not work for Holoeverywhere on preHC androids, FontLoader on preHC loads roboto font in all textviews.
For applying font have a look at class org.holoeverywhere.FontLoader
and FontLoader#apply(View)
method.