preferenceactivity

Android: Creating custom preference

有些话、适合烂在心里 提交于 2019-11-26 12:50:14
Is it possible to create an individual preference in an PreferenceScreen ? I would like to code color settings like that: I know that choosing the color is easy realizable with the ListPreference , but it would be awesome with that kind of "checkboxes". Dave The Android Developer page only shows how to make a DialogFragment . It's still possible to customise the appearance of a Preference item though. In your XML you have to declare the root element as android:id="@android:id/widget_frame , and then declare TextView as android:title and android:summary . You can then declare other elements you

No ActionBar in PreferenceActivity after upgrade to Support Library v21

江枫思渺然 提交于 2019-11-26 12:43:19
After I upgraded to the Support Library v21 my ActionBar in my PreferenceActivity is gone. Did I miss some attributes in my theme to activate it again? I had some similar trouble with a black ActionBar . I also tried to add it a little hackish by adding a Toolbar to the root layout, but that did not work as expected. David Passmore Please find the GitHub Repo: Here Very Similar to your own code but added xml to allow for set title: Continuing to use PreferenceActivity : settings_toolbar.xml : <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http:/

How to add Action Bar from support library into PreferenceActivity?

一世执手 提交于 2019-11-26 08:57:45
问题 Action Bar compatibility has been added into support library, revision 18. It now has ActionBarActivity class for creating activities with Action Bar on older versions of Android. Is there any way to add Action Bar from support library into PreferenceActivity ? Previously I used ActionBarSherlock and it has SherlockPreferenceActivity . 回答1: EDIT: In appcompat-v7 22.1.0 Google added the AppCompatDelegate abstract class as a delegate you can use to extend AppCompat's support to any activity.

Custom PreferenceCategory Headings

杀马特。学长 韩版系。学妹 提交于 2019-11-26 08:47:17
问题 I have a simple preference screen defined like this <PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\"> <PreferenceCategory android:title=\"Security\"> <CheckBoxPreference android:title=\"Require Pin on Start\" android:summary=\"Require pin to run the application\" android:key=\"@string/pref_require_pin\" android:defaultValue=\"false\" /> </PreferenceCategory> <PreferenceCategory android:title=\"Settings\"> <ListPreference android:title=\"History Age (in days)\"

PreferenceActivity Android 4.0 and earlier

核能气质少年 提交于 2019-11-26 06:05:04
问题 Trying the different preference activities in the ApiDemos for Android 4.0, I see in the code that some methods are deprecated in PreferencesFromCode.java, for example. So my question is: if I use PreferenceFragment, will it work for all version or only 3.0 or 4.0 and up? If so, what should I use that works for 2.2 and 2.3 as well? 回答1: PreferenceFragment will not work on 2.2 and 2.3 (only API level 11 and above). If you want to offer the best user experience and still support older Android

Android: Creating custom preference

匆匆过客 提交于 2019-11-26 03:37:33
问题 Is it possible to create an individual preference in an PreferenceScreen ? I would like to code color settings like that: I know that choosing the color is easy realizable with the ListPreference , but it would be awesome with that kind of \"checkboxes\". 回答1: The Android Developer page only shows how to make a DialogFragment . It's still possible to customise the appearance of a Preference item though. In your XML you have to declare the root element as android:id="@android:id/widget_frame ,

No ActionBar in PreferenceActivity after upgrade to Support Library v21

醉酒当歌 提交于 2019-11-26 03:36:46
问题 After I upgraded to the Support Library v21 my ActionBar in my PreferenceActivity is gone. Did I miss some attributes in my theme to activate it again? I had some similar trouble with a black ActionBar. I also tried to add it a little hackish by adding a Toolbar to the root layout, but that did not work as expected. 回答1: Please find the GitHub Repo: Here Very Similar to your own code but added xml to allow for set title: Continuing to use PreferenceActivity : settings_toolbar.xml : <?xml

How do I get the SharedPreferences from a PreferenceActivity in Android?

て烟熏妆下的殇ゞ 提交于 2019-11-26 01:26:13
问题 I am using a PreferenceActivity to show some settings for my application. I am inflating the settings via a xml file so that my onCreate (and complete class methods) looks like this: public class FooActivity extends PreferenceActivity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.preference); } } The javadoc of PreferenceActivity PreferenceFragment states that These preferences will automatically save to SharedPreferences as the