android-preferences

Remove empty icon spaces on androidx preferences

久未见 提交于 2020-12-12 06:16:05
问题 I have just migrated my project to use androidx libraries. The new preferences/Settings Screen now displays empty icon spaces as shown in the picture here. I tried the official documentation with no luck. How to remove the empty icon spaces before preferences? 回答1: You can remove the empty icon space with this: app:iconSpaceReserved="false" 来源: https://stackoverflow.com/questions/54394971/remove-empty-icon-spaces-on-androidx-preferences

PreferenceFragment with transparent background?

风流意气都作罢 提交于 2020-07-06 09:50:39
问题 I have created a PreferenceFragment with two categories and one checkbox, however, when I display it in my app, the background appears to be transparent. I can see the main activities, fields and the PreferenceFragment ones are laid over top of the ones from the main activity...what is the solution to this? In my main activity I am doing this to open the PreferenceFragment when the settings button is selected: @Override public boolean onOptionsItemSelected(MenuItem item) { //handle presses on

PreferenceFragment with transparent background?

冷暖自知 提交于 2020-07-06 09:50:22
问题 I have created a PreferenceFragment with two categories and one checkbox, however, when I display it in my app, the background appears to be transparent. I can see the main activities, fields and the PreferenceFragment ones are laid over top of the ones from the main activity...what is the solution to this? In my main activity I am doing this to open the PreferenceFragment when the settings button is selected: @Override public boolean onOptionsItemSelected(MenuItem item) { //handle presses on

DropDownPreference setOnPreferenceChangeListener calls itself when initialized

谁都会走 提交于 2020-06-17 09:46:09
问题 I have filed a bug here on this issue which I believe is a platform bug. If you have a DropDownPreference OnPreferenceChangeListener, Android appears to "choose" the first item once and only once when the screen is first opened on a fresh app, thereby firing the listener. Has anyone seen this behavior and how might I prevent it? I tried putting in a boolean preference flag to filter the misfire out, but now the first option in my dropdown is unselectable until I choose another option. I

How to apply changes to widget when placing it on the homescreen in onEnabled?

怎甘沉沦 提交于 2020-03-06 02:31:32
问题 When I try to put my weather widget on the homescreen I want to give the user an option of choosing a city at that moment and the widget starts showing the weather for that city. For this I have made use of onEnabled method in Provider class. So what I am doing here is just starting an activity to some preference class where I make use of string array to give the user the option to choose. And then OnSharedPreferenceChangeListener inside onEnabled again I am starting another activity with the

What's the difference between getDefaultSharedPreferences() and getPreferences()?

空扰寡人 提交于 2020-01-27 23:26:27
问题 I'm currently taking the "Developing Android Apps" Udacity course. In the "Lesson 3: New Activities and Intents > Use SharedPreferences" segment, the instructor asked me to dig around the Android Developer site for how to get the user preferences from SharedPreferences . However, I found it different between the official documentation and the course's solution. The Udacity course's solution says, to grab a SharedPreferences instance for the PreferenceActivity , you should call: