From 846234f399777a50e7d02260f742ad88cf5e9d52 Mon Sep 17 00:00:00 2001 From: Doris Ling Date: Fri, 23 Jun 2017 13:41:22 -0700 Subject: [PATCH] Fix issue for Preference.setSingleLineTitle() has no effect. The flag to check whether the single line title attribute is initialized only when we processed the layout attributes. When the attribute is not set in the layout, but set through the setter method, the flag is not being updated properly, and hence the title view is not set correctly. Need to update the flag as well when the setter method is called. Bug: 62947301 Test: manual Change-Id: If843663165a0f3348048aaf1d920f3b740af5bc3 --- core/java/android/preference/Preference.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java index 2179bd45e3033..4306bc47f2b52 100644 --- a/core/java/android/preference/Preference.java +++ b/core/java/android/preference/Preference.java @@ -934,6 +934,7 @@ public class Preference implements Comparable { * @param singleLineTitle set {@code true} if the title should be constrained to one line */ public void setSingleLineTitle(boolean singleLineTitle) { + mHasSingleLineTitleAttr = true; mSingleLineTitle = singleLineTitle; notifyChanged(); }