Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 570
Doctiger Avatar asked Feb 04 '23 21:02

Doctiger


1 Answers

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>
like image 109
Fabio Fracassi Avatar answered Feb 06 '23 16:02

Fabio Fracassi