preferencefragment

Keep the actionbar displayed in when changing PreferenceScreen

自古美人都是妖i 提交于 2019-12-03 01:43:54
I'm trying to display a actionbar in my preference screen. In order to do so I added the following code in my SettingActivity public class PreferencesActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.preferences_activity); getFragmentManager().beginTransaction() .replace(R.id.container, new PreferencesFragment()).commit(); getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP); getSupportActionBar()

Toolbar is hidden in nested PreferenceScreen

扶醉桌前 提交于 2019-12-02 20:42:24
I use PreferenceFragment in ActionBarActivity from support-v7 library. In the Activity I have Toolbar . Everything goes okay, until I open a nested PreferenceScreen . In the opened screen the Toolbar is hidden. Maybe somebody know a workaround for this issue? Preferences xml-file: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <PreferenceCategory android:title="Main category" > <EditTextPreference android:defaultValue="defaultValue" android:key="key_global_setting" android:title="Global title" /> </PreferenceCategory>

How to open a new PreferenceFragment from current one, using the new Android-X API?

对着背影说爱祢 提交于 2019-12-01 19:27:58
Background On previous versions of support library, we could use headers in order to have a main-menu screen of settings, that each would open a new settings screen (fragment) . The problem Now headers are gone (as written here ) for some time, and I think it became worse on android-x : One thing you’ll note isn’t in here is preference headers and you’d be totally right. However, that doesn’t mean a single list of preferences need to span a 10” tablet screen. Instead, your Activity can implement OnPreferenceStartFragmentCallback ( link ) to handle preferences with an app:fragment attribute or

(Activity+preferencefragment) Error inflating class com.android.internal.widget.ActionBarContainer

偶尔善良 提交于 2019-12-01 10:53:59
问题 I have no idea about this error. I got these mesaage from google developer console. Some devices like z3, htc m8 ,m9 can't execute my app. Could someone give me some hint about the error? Stacktrace : java.lang.RuntimeException: Unable to start activity ComponentInfo{package name/package name.SettingsActivity}: android.view.InflateException: Binary XML file line #31: Error inflating class com.android.internal.widget.ActionBarContainer at android.app.ActivityThread.performLaunchActivity

android support v14 PreferenceFragment crashes

六月ゝ 毕业季﹏ 提交于 2019-11-30 17:40:44
问题 I'm trying to display settings in an Android app using a PreferenceFragment from the android.support.v14.preference library. However, when I try to open the preferences the app crashes with a strange NullPointerException. This doesn't happen if I leave out the call to addPreferenceFromResource(R.xml.preferences) in my the PreferenceFragment, but then of course the preferences never get shown. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hardboard.preferencetest/com

PreferenceFragmentCompat has padding on PreferenceCategory that I can't get rid of

大兔子大兔子 提交于 2019-11-27 08:15:08
So I've been trying to create a settings activity using androidx.preference.PreferenceFragmentCompat and it's all working fine. However for some reason there is some padding present on both the preference categories and the preferences themselves. I managed to get rid of the padding on the preferences by using app:iconSpaceReserved="false" but this doesn't seem to work on the categories. Image I've tried all the various themes, PreferenceThemeOverlay.v14.Material etc but they don't seem to make a difference Here is my code for everything! SettingsActivity.java import android.os.Bundle; import

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