Doctiger
Doctiger

Reputation: 2508

Android: How to disable Reserved Icon Space in Preference Screen

I have got a trouble with layout of Preference screen after updated SDK to version 28 (Android Pie). Each PreferenceScreen has a new padding on the left.

As I've checked, there is a method to set icon space as reserved in Preference class already.

android.support.v7.preference.Preference.setIconSpaceReserved(boolean iconSpaceReserved)

The method is good so far, but the problem is that it doesn't work with PreferenceCategory.

Does this mean that the left padding on PreferenceCategory is not a space for icon?

Upvotes: 11

Views: 4789

Answers (2)

Fabio Fracassi
Fabio Fracassi

Reputation: 378

Solved using app:iconSpaceReserved="false" in the preference xml (under each item).

    <PreferenceCategory
    android:title="Pro Settings"
    app:iconSpaceReserved="false"
    >

    <CheckBoxPreference
        android:defaultValue="false"
        android:key="plugin"
        android:title="@string/EnablePlugin"
        android:summary="@string/PluginDescription"
        android:id="@+id/Pref"
        app:iconSpaceReserved="false"
        />

</PreferenceCategory>

Upvotes: 9

Abu Abdulla
Abu Abdulla

Reputation: 83

it is a bug and already solved. you need to wait for the update

https://issuetracker.google.com/issues/111662669

Upvotes: 3

Related Questions