The question:
How do you change the text size used for the android:title attribute when the Preference items are listed in the settings menu?
The details:
The Settings screen in my app looks good on a Nexus 7 (Jelly Bean) tablet, but is almost unusable on a Motorola Defy (Gingerbread) phone. I am using the standard PreferenceActivity approach as detailed in the Android Dev guides.
I have been searching the web for several days, but have not found a solution that makes things look any different.
On the Android-Gingerbread phone;
1) the <EditTextPreference android:title .../>
text is way too big, and doesn't word-wrap.
2) the standard "down arrow" icons next to each preference item look weird and misaligned. (misaligned icon image)
3) the theme is Holo, but a large blank region below the last preference item is an ugly light grey for some reason.
I've tried defining style.xml resources and putting style="@style/StyleName" in the preferences.xml to change the android:textSize attribute, but it didn't do anything.
Below is the XML for my preference screen:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/SettingsMenu" >
<PreferenceCategory
android:key="pref_key_mixProportions"
android:title="@string/pref_title_mixProportions"
style="@style/SettingsMenu"
>
<EditTextPreference
android:key="pref_key_binderPortion"
android:title="@string/pref_title_binderPortion"
android:dialogTitle="Binder Portion"
android:inputType="numberDecimal"
android:maxLines="2"
android:scrollHorizontally="false"
android:defaultValue="1"
android:persistent="true" />
<EditTextPreference
android:key="pref_key_premixPortion"
android:title="@string/pref_title_premixPortion"
android:dialogTitle="Premix Portion"
android:inputType="numberDecimal"
android:layout_width="wrap_content"
android:maxLines="2"
android:scrollHorizontally="false"
android:defaultValue="5"
android:persistent="true"/>
</PreferenceCategory>
<PreferenceCategory
android:key="pref_key_binderProperties"
android:title="@string/pref_title_binderProperties">
<EditTextPreference
android:key="pref_key_binderDensity"
android:title="@string/pref_title_binderDensity"
android:dialogTitle="Density of Binder powder (kg/m^3)"
android:inputType="numberDecimal"
android:defaultValue="2850"
android:persistent="true"
android:summary="@string/pref_summary_binderDensity"/>
<EditTextPreference
android:key="pref_key_binderBagWeight"
android:title="@string/pref_title_binderBagWeight"
android:dialogTitle="Weight of Binder per bag (kg)"
android:inputType="numberDecimal"
android:defaultValue="20"
android:persistent="true" />
</PreferenceCategory>
<PreferenceCategory
android:key="pref_key_premixProperties"
android:title="@string/pref_title_premixProperties">
<EditTextPreference
android:key="pref_key_premixDensity"
android:title="@string/pref_title_premixDensity"
android:dialogTitle="Density of Sand and Aggregate Mix (kg/m^3)"
android:inputType="numberDecimal"
android:defaultValue="1850"
android:persistent="true"
android:summary="@string/pref_summary_premixDensity"/>
</PreferenceCategory>
</PreferenceScreen>
My styles.xml contains:
<style name="SettingsMenu">
<item name="android:textSize">15sp</item>
</style>
But the text looks the same regardless of what value I give for the size.
I've seen that some people suggest using <PreferenceScreen android:layout=".... />
but I've found no clear explanation of how this is done.
Can anyone help?