I'm using time picker class from: https://stackoverflow.com/a/10608622/1261256
On preference screen, I have several options (eg ringtone) in addition to 'Time', which is tied to the above time picker class.
However, the text for 'Time' is larger than the text for the other preferences. How can I make it uniform?
This is settings.xml:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:defaultValue="true"
android:key="notification" />
<com.xxxx.TimePreference
android:key="notification_time"
android:dependency="notification"
android:title="@string/pref_notification_time" />
<RingtonePreference
android:defaultValue="content://settings/system/notification_sound"
android:dependency="notification"
android:key="notification_ringtone"
android:ringtoneType="notification"
android:title="@string/pref_title_ringtone" />
</PreferenceScreen>
Above xml file gets added using:
addPreferencesFromResource(R.xml.settings);
I just ran into this too.
The TimePreference
class, in its 2 parameter constructor, calls the 3 parameter constructor with 0
for the third parameter, which uses the default style. Since this is a Preference class, it should call it with android.R.attr.preferenceStyle
as the third parameter to use the preference style. Make a change to the code so the two parameter constructor looks like this:
public TimePreference(Context ctxt, AttributeSet attrs) {
this(ctxt, attrs, android.R.attr.preferenceStyle);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.