Reputation: 423
I have following layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="10sp"
android:paddingBottom="10sp">
<ImageView
android:id="@+id/newsImage"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:contentDescription="@string/hello_world"
android:src="@drawable/ic_program_blue" />
<RelativeLayout
android:id="@+id/textLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/newsImage">
<TextView
android:id="@+id/titleText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world"
style="@style/newsListItemTitle" />
<TextView
android:id="@+id/shortText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/titleText"
android:text="@string/hello_world"
style="@style/newsListItemShort" />
</RelativeLayout>
</RelativeLayout>
And this style definition:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:style/Theme.Holo.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>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<!-- NAVIGATION DRAWER -->
<!-- Items -->
<style name="navDrawerItem">
<item name="android:minHeight">48dp</item>
<item name="android:textSize">22sp</item>
<item name="android:textColor">#686868</item>
<item name="android:paddingRight">40dp</item>
<item name="android:gravity">center_vertical</item>
</style>
<!-- NEWS -->
<!-- Item title -->
<style name="newsListItemTitle">
<item name="android:singleLine">true</item>
<item name="android:background">#66ffffff</item>
<item name="android:paddingTop">10dp</item>
<item name="android:paddingLeft">5dp</item>
<item name="android:textColor">#000000</item>
<item name="android:textSize">23sp</item>
</style>
<!-- Item short -->
<style name="newsListItemShort">
<item name="android:singleLine">true</item>
<item name="android:background">#66ffffff</item>
<item name="android:paddingLeft">5dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:textColor">#686868</item>
<item name="android:textSize">15sp</item>
</style>
</resources>
Everything gets applied to the TextViews, except the "textSize". No text does appear in the configured textSize height. Any idea, why this is not working?
No compile errors.
When I apply the property "textSize" with the TextView directly everythink works fine.
Thanks
Upvotes: 1
Views: 626
Reputation: 423
I made the corrections to the wrong "styles.xml" file. I have a styles file for API larger than 16. And this file gets used. But I edited the standard "styles.xml".
Upvotes: 2
Reputation: 13248
Try to add in the below folder structure:
res/values/dimens.xml
res/values-small/dimens.xml
res/values-normal/dimens.xml
res/values-xlarge/dimens.xml
Example:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="text_size">18sp</dimen>
</resources>
Upvotes: 0