preferencescreen

Is possible to change the summary of EditTextPreference dynamically in Android?

隐身守侯 提交于 2019-12-07 07:32:51
问题 I set up a preferenceScreen to edit the settings in my application. I would like to insert an EditTextPreference that contains a Title like "set your name" and a summary containing the name entered. Is that possible? thank you in advance! 回答1: Sure, here is a short example: EditTextPreference etp = (EditTextPreference) findPreference("the_pref_key"); etp.setSummary("New summary"); This requires that you display your preferences either from a PreferenceActivity or from a PreferenceFragment ,

Nested preference screens lose theming

末鹿安然 提交于 2019-12-06 22:34:00
问题 I have a preference screen for my application and in the manifest I have given it a theme using: android:theme="@android:style/Theme.Light.WallpaperSettings" However when I nest another preference screen inside this one such as: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:title="@string/setting_title" android:key="..."> <PreferenceCategory android:title="@string/title_themes" > <PreferenceScreen android:title="

Instantiating an inner class (Preference) in xml file

十年热恋 提交于 2019-12-06 21:19:12
问题 When you want to access a custom view in some layout.xml file, you have two options: The view is in it's own class. Then you do <package.name.MyView android:layout_width= ... /> The view is an inner class: <view class="package.name.OuterClass$MyView" android:layout_width= ... /> Now I want to do the same thing inside a <PreferenceScreen> . The first way works well, but I would like to put all the custom Preference classes together in my PreferenceActivity. I tried <Preference class="package

how to make the nested Android PreferenceScreen show in Full Screen(without titlebar in system)

亡梦爱人 提交于 2019-12-06 09:46:01
I have write an PreferenceActivity and it contains nested child PreferenceScreen. the problem is i want made them FullScreen, i've add theme.fullscreen in AndroidManifest and it works, but when i click on one of the sub-item to enter an nested PreferenceScreen, the title bar appears. and now i didn't know how to make the nested full screen too. and i've look source code for PreferenceScreen to find help. it shows that nested preferenceScreen was showed on an Dialog, and i found the code which new the Dialog in method showDialog. Dialog dialog = mDialog = new Dialog(context, TextUtils.isEmpty

Is possible to change the summary of EditTextPreference dynamically in Android?

梦想与她 提交于 2019-12-05 13:33:19
I set up a preferenceScreen to edit the settings in my application. I would like to insert an EditTextPreference that contains a Title like "set your name" and a summary containing the name entered. Is that possible? thank you in advance! Sure, here is a short example: EditTextPreference etp = (EditTextPreference) findPreference("the_pref_key"); etp.setSummary("New summary"); This requires that you display your preferences either from a PreferenceActivity or from a PreferenceFragment , since findPreference() is a method of these classes. You most likely do that already. To change the summary

Return from nested Android PreferenceScreen to previous PreferenceScreen

独自空忆成欢 提交于 2019-12-05 05:25:01
问题 I am programmatically creating a nested set of PreferenceScreen s. When the user dives into one of these screens, and taps something in there, I want to go back to the previous PreferenceScreen , (i.e. the "parent"). I couldn't find any information on this, and calling finish() doesn't do the job but rather returns from ALL the PreferenceScreen s instead of just one. 回答1: I just meet the problem and just found the solution. You can override the method onPreferenceTreeClick in

Instantiating an inner class (Preference) in xml file

时光总嘲笑我的痴心妄想 提交于 2019-12-05 02:13:05
When you want to access a custom view in some layout.xml file, you have two options: The view is in it's own class. Then you do <package.name.MyView android:layout_width= ... /> The view is an inner class: <view class="package.name.OuterClass$MyView" android:layout_width= ... /> Now I want to do the same thing inside a <PreferenceScreen> . The first way works well, but I would like to put all the custom Preference classes together in my PreferenceActivity. I tried <Preference class="package.name.OuterClass$MyPreference" ... /> (also with '.' instead of '$') as well as <package.name.OuterClass

How do I programmatically add EditTextPreferences to my PreferenceFragment?

落花浮王杯 提交于 2019-12-04 20:17:54
问题 I am new to Android, so I need a little guidance on how to programmatically add EditTextPreference objects to my PreferenceFragment . I am pulling in a list of values from a web service. I have saved them successfully to my SharedPreferences , and I use them to generate URLs (path portion). I would like the users of my app to be able to edit these values, but after lots of searching on Google, it isn't clear to me how to programmatically add EditTextPreference objects to my PreferenceFragment

Return from nested Android PreferenceScreen to previous PreferenceScreen

ε祈祈猫儿з 提交于 2019-12-03 21:55:17
I am programmatically creating a nested set of PreferenceScreen s. When the user dives into one of these screens, and taps something in there, I want to go back to the previous PreferenceScreen , (i.e. the "parent"). I couldn't find any information on this, and calling finish() doesn't do the job but rather returns from ALL the PreferenceScreen s instead of just one. I just meet the problem and just found the solution. You can override the method onPreferenceTreeClick in PreferenceActivity. call the param preferenceScreen's getDialog method, then call the dialog's dismiss method. just like

How do I programmatically add EditTextPreferences to my PreferenceFragment?

我与影子孤独终老i 提交于 2019-12-03 12:55:57
I am new to Android, so I need a little guidance on how to programmatically add EditTextPreference objects to my PreferenceFragment . I am pulling in a list of values from a web service. I have saved them successfully to my SharedPreferences , and I use them to generate URLs (path portion). I would like the users of my app to be able to edit these values, but after lots of searching on Google, it isn't clear to me how to programmatically add EditTextPreference objects to my PreferenceFragment . Please note, my PreferenceFragment is working fine for the SharedPreferences values I hard code as