Assigned
Status Update
Comments
vi...@google.com <vi...@google.com>
vi...@google.com <vi...@google.com> #2
We have passed this to the development team and will update this issue with more information as it becomes available.
lp...@google.com <lp...@google.com> #3
Hi,
The empty space comes from the Material specifications - this is not only for screens with icons, as it also ensures that the title of each Preference lines up with the title in the ActionBar. Please seehttps://material.io/design/platform-guidance/android-settings.html#label-secondary-text - the section with 'Alignment'. Note that in the example screenshot there are no icons, and this spacing is solely for the title alignment.
Regarding: 'Also, please add app:iconSpaceReserved for PreferenceCategory, as currently it works only for other Preferences.' - this bug has been fixed and will be available in an upcoming release.
The empty space comes from the Material specifications - this is not only for screens with icons, as it also ensures that the title of each Preference lines up with the title in the ActionBar. Please see
Regarding: 'Also, please add app:iconSpaceReserved for PreferenceCategory, as currently it works only for other Preferences.' - this bug has been fixed and will be available in an upcoming release.
lb...@gmail.com <lb...@gmail.com> #4
@3 Right, and most of the times, there aren't any icons, including in the toolbar (toolbar might have an "up" button), so there is nothing to be aligned to, and as such this space is useless and doesn't align to anything, and causes everything to take more space than it should.
See the link I've provided for various cases this is a bad decision of having wasted space, and where Google itself didn't always align things and put spaces in all cases.
Also, BTW, even when the Toolbar does have something on the left of the title, it doesn't make sense to have the preferences text to be aligned to it, as it's a very different component that resides in a different layout.
So please make it easier to avoid this forced bad behavior that doesn't fit most cases and avoid misalignment that even Google got on its own apps, by having a single attribute we could use to apply to all of the preferences and their descendants , instead of having to apply it for each of them ourselves, or use some weird workarounds.
See the link I've provided for various cases this is a bad decision of having wasted space, and where Google itself didn't always align things and put spaces in all cases.
Also, BTW, even when the Toolbar does have something on the left of the title, it doesn't make sense to have the preferences text to be aligned to it, as it's a very different component that resides in a different layout.
So please make it easier to avoid this forced bad behavior that doesn't fit most cases and avoid misalignment that even Google got on its own apps, by having a single attribute we could use to apply to all of the preferences and their descendants , instead of having to apply it for each of them ourselves, or use some weird workarounds.
lb...@gmail.com <lb...@gmail.com> #5
And if you wish for an example of when a settings screen won't have an "up" button, you can think of apps that are just live wallpaper or a widget, so the main Activity is actually the one of the settings screen.
lb...@gmail.com <lb...@gmail.com> #6
@3 BTW, even on the website you've shown, there are cases the text doesn't align:
https://storage.googleapis.com/spec-host-backup/mio-design%2Fassets%2F1TCRgDZ3cDzmJLN3Kup3yT_Kg3-BUKbug%2Fcommunication-settings-sidenav.png
https://storage.googleapis.com/spec-host-backup/mio-design%2Fassets%2F1EiETBMwdTwGr4EokSvzlFaEyw1KGUx3z%2Fas-settings-selectionpatterns-multiplechoice.png
Not everything can and should be aligned. When the title of the settings screen doesn't have an icon, it doesn't need more space. Even when it does have, it doesn't make sense that all views below it should be aligned, and that we will be forced to have less screen space just because of it.
This, together with the expandable stuff on settings screen, made it extremely annoying to scroll in settings screens, especially for me as I use the settings screens a lot. I even requested that it will be possible to avoid the expanding, or at least be remembered:
https://issuetracker.google.com/issues/65502194
I also requested to make it shorter to reach the various settings:
https://issuetracker.google.com/issues/78046684
But it was rejected for some reason, telling me I should request it for tiles, even though I don't need tiles... so I made a request for this too:
https://issuetracker.google.com/issues/78242794 https://issuetracker.google.com/issues/116250241
Not everything can and should be aligned. When the title of the settings screen doesn't have an icon, it doesn't need more space. Even when it does have, it doesn't make sense that all views below it should be aligned, and that we will be forced to have less screen space just because of it.
This, together with the expandable stuff on settings screen, made it extremely annoying to scroll in settings screens, especially for me as I use the settings screens a lot. I even requested that it will be possible to avoid the expanding, or at least be remembered:
I also requested to make it shorter to reach the various settings:
But it was rejected for some reason, telling me I should request it for tiles, even though I don't need tiles... so I made a request for this too:
dc...@gmail.com <dc...@gmail.com> #7
Regarding @3
On Android 4.4.2 (Motorola RAZR HD) the preferences don't align to the action bar.
Here are my project settings:
Settings activity extends androidx.appcompat.app.AppCompatActivity
Settings fragment extends androidx.preference.PreferenceFragmentCompat
Main activity has a toolbar (androidx.appcompat.widget.Toolbar) configured as an action bar
final Toolbar toolbar = findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setDisplayHomeAsUpEnabled(true);
}
}
It is a simple activity with a toolbar and a frame layout where I load my preferences fragment.
This is part of my preferences.xml file.
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android "
android:key="preferences_root">
<androidx.preference.PreferenceCategory
android:key="category_settings"
android:title="@string/scanner">
<androidx.preference.SwitchPreferenceCompat
android:defaultValue="true"
android:key="preference_shutter_sound"
android:persistent="true"
android:summaryOff="@string/shutter_sound_summary_off"
android:summaryOn="@string/shutter_sound_summary_on"
android:title="@string/shutter_sound" />
The reason I use specific AndroidX tags instead of the system tags like <PreferenceScreen> and <SwitchPreference> is that on Android 4.4.2 the system tags look all wrong, specially the SwitchPreference.
When everything is set the preference screen shows like in the attatchment "bug_preference_Motorola.png".
The same screen does align with the title on Android 8.0 (Samsung Galaxy S8) as seen in the attachment "preference_Samsung.png".
So at least we have a bug where the alignment isn't right on all versions of Android.
On Android 4.4.2 (Motorola RAZR HD) the preferences don't align to the action bar.
Here are my project settings:
Settings activity extends androidx.appcompat.app.AppCompatActivity
Settings fragment extends androidx.preference.PreferenceFragmentCompat
Main activity has a toolbar (androidx.appcompat.widget.Toolbar) configured as an action bar
final Toolbar toolbar = findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
ActionBar supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setDisplayHomeAsUpEnabled(true);
}
}
It is a simple activity with a toolbar and a frame layout where I load my preferences fragment.
This is part of my preferences.xml file.
<androidx.preference.PreferenceScreen xmlns:android="
android:key="preferences_root">
<androidx.preference.PreferenceCategory
android:key="category_settings"
android:title="@string/scanner">
<androidx.preference.SwitchPreferenceCompat
android:defaultValue="true"
android:key="preference_shutter_sound"
android:persistent="true"
android:summaryOff="@string/shutter_sound_summary_off"
android:summaryOn="@string/shutter_sound_summary_on"
android:title="@string/shutter_sound" />
The reason I use specific AndroidX tags instead of the system tags like <PreferenceScreen> and <SwitchPreference> is that on Android 4.4.2 the system tags look all wrong, specially the SwitchPreference.
When everything is set the preference screen shows like in the attatchment "bug_preference_Motorola.png".
The same screen does align with the title on Android 8.0 (Samsung Galaxy S8) as seen in the attachment "preference_Samsung.png".
So at least we have a bug where the alignment isn't right on all versions of Android.
lb...@gmail.com <lb...@gmail.com> #8
@7 Good catch. I suggest creating a new issue for this, and have a working sample project too.
lb...@gmail.com <lb...@gmail.com> #10
@9 Thank you.
lb...@gmail.com <lb...@gmail.com> #11
Attached here a new sample of how to avoid the padding.
lb...@gmail.com <lb...@gmail.com> #12
It's still a workaround though.
My request is to have it easily set.
My request is to have it easily set.
Description
Currently, the only way to achieve this, is to set app:iconSpaceReserved for each preference, and have a special workaround for PreferenceCategory :
Please allow to add an attribute in the PreferenceScreen (and other parent Preferences) to apply this behavior on all of its child preferences: "defaultIconSpaceBehavior" , with values : "alwaysReserveSpace" (always have space for icons, even if there are no icons), "removeSpaceWhenPossible" (for each preference, have space for icon, only if there is an icon) .
This will set the default behavior for all child preference and descendants.
Maybe also other values.
Also, please add app:iconSpaceReserved for PreferenceCategory, as currently it works only for other Preferences.