preference-v7

PreferenceFragmentCompat padding issue with @style/PreferenceThemeOverlay

流过昼夜 提交于 2020-01-13 06:17:07
问题 While using the default PreferenceThemeOverlay from the preference-v7 support library (version 23.1.0) I ran into the following issue. Starting from API 22 my PreferenceFragmentCompat had an ugly additional padding added to the left and right side of my preference list. build.gradle: compile 'com.android.support:appcompat-v7:23.1.0' styles.xml: <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> After I didn't find any helpful solution on stackoverflow I wrote a workaround

HowTo use support.v7.preference with AppCompat and potential drawbacks

南楼画角 提交于 2019-12-18 10:24:31
问题 I was trying to implement preferences for an AppCompat app, using support.v7.preference. It took me a couple of days to fiddle through it, since support.v7.preference has some significant differences to the native preferences... which isn't too bad once you know, but unfortunately there's little documentation out there. I thought I'd share my findings so others don't have to go through the same pain. So... question: How do you best implement Preferences for AppCompat apps (with

How to move back from Preferences subscreen to main screen in PreferenceFragmentCompat?

时间秒杀一切 提交于 2019-11-30 13:03:31
I am trying to implement a Settings screen using PreferenceFragmentCompat. My preference xml has a preference subscreen like this: preferences.xml <CheckBoxPreference android:defaultValue="false" android:key="@string/pref_sound_key" android:summary="@string/pref_sound_summary" android:title="@string/pref_sound_title" /> <PreferenceScreen android:title="Inner Screen"> <CheckBoxPreference android:defaultValue="true" android:key="@string/key_1" android:title="@string/title_1" /> <CheckBoxPreference android:defaultValue="true" android:key="@string/key_1" android:title="@string/title_1" />

HowTo use support.v7.preference with AppCompat and potential drawbacks

我与影子孤独终老i 提交于 2019-11-29 21:05:25
I was trying to implement preferences for an AppCompat app, using support.v7.preference. It took me a couple of days to fiddle through it, since support.v7.preference has some significant differences to the native preferences... which isn't too bad once you know, but unfortunately there's little documentation out there. I thought I'd share my findings so others don't have to go through the same pain. So... question: How do you best implement Preferences for AppCompat apps (with PreferenceFragment and AppCompatAcitivity being incompatible)? Here are a couple of related questions: Preference sub

How to move back from Preferences subscreen to main screen in PreferenceFragmentCompat?

你说的曾经没有我的故事 提交于 2019-11-29 12:49:26
问题 I am trying to implement a Settings screen using PreferenceFragmentCompat. My preference xml has a preference subscreen like this: preferences.xml <CheckBoxPreference android:defaultValue="false" android:key="@string/pref_sound_key" android:summary="@string/pref_sound_summary" android:title="@string/pref_sound_title" /> <PreferenceScreen android:title="Inner Screen"> <CheckBoxPreference android:defaultValue="true" android:key="@string/key_1" android:title="@string/title_1" />

Inner PreferenceScreen does not open with PreferenceFragmentCompat

╄→гoц情女王★ 提交于 2019-11-28 04:10:22
My inner PreferenceScreen of PreferenceFragmentCompat is not showing, or seems to ignore tapping events. I created MyPreferenceFragment that extends PreferenceFragmentCompat public class MyPreferenceFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.preferences); } } then I changed my theme at styles.xml like <style name="AppTheme" parent="@style/Theme.AppCompat.Light"> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> </style> And finally create my preferences.xml

Inner PreferenceScreen does not open with PreferenceFragmentCompat

戏子无情 提交于 2019-11-27 00:18:03
问题 My inner PreferenceScreen of PreferenceFragmentCompat is not showing, or seems to ignore tapping events. I created MyPreferenceFragment that extends PreferenceFragmentCompat public class MyPreferenceFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.preferences); } } then I changed my theme at styles.xml like <style name="AppTheme" parent="@style/Theme.AppCompat.Light"> <item name=

PreferenceFragmentCompat requires preferenceTheme to be set

给你一囗甜甜゛ 提交于 2019-11-26 13:59:33
With the new PreferenceFragmentCompat from the v7 Preference Support Library: http://developer.android.com/tools/support-library/features.html#v7-preference , I get this error E java.lang.IllegalStateException: Must specify preferenceTheme in theme E at android.support.v7.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:202) What theme should be set? Update: I have tried using <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> as suggested by @Bogato but it doesn't look right and looks very Holo even on Lollipop. Support library: Native preferences: The

PreferenceFragmentCompat requires preferenceTheme to be set

本秂侑毒 提交于 2019-11-26 03:47:15
问题 With the new PreferenceFragmentCompat from the v7 Preference Support Library: http://developer.android.com/tools/support-library/features.html#v7-preference, I get this error E java.lang.IllegalStateException: Must specify preferenceTheme in theme E at android.support.v7.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:202) What theme should be set? Update: I have tried using <item name=\"preferenceTheme\">@style/PreferenceThemeOverlay</item> as suggested by @Bogato