Android:如何禁用首选项屏幕中的保留的图标空间

时间:2018-09-27 17:24:14

标签: android android-layout android-support-library android-preferences

在将SDK更新到版本28(Android Pie)后,“首选项”屏幕的布局出现了问题。每个PreferenceScreen的左侧都有一个新的填充。

我已经检查过,有一种方法可以将图标空间设置为Preference类中的保留空间。

245133 Query    ROLLBACK
                245671 Connect  root@localhost as anonymous on
                245671 Query    select * from information_schema.innodb_trx
                244093 Query    ROLLBACK
                245671 Quit
                245133 Init DB  DB_NAME
                245133 Query    SELECT `DESC` as Status FROM TABLE WHERE REC_NUM != 2 ORDER BY `REC_NUM`
                245133 Query    ROLLBACK
                244093 Init DB  DB_NAME
                244093 Query    SELECT COLUMN FROM TABLE WHERE COLUMN IN (SELECT COLUMN FROM TABLE WHERE STATUSCODE = 3) ORDER BY COLUMN
                244093 Query    ROLLBACK
                245133 Init DB  DB_NAME
                245133 Query    SELECT COLUMN FROM TABLE GROUP BY COLUMN ORDER BY COLUMN
                245133 Query    ROLLBACK
                244093 Init DB  DB_NAME
                244093 Query    SELECT COLUMN as Status FROM TABLE WHERE COLUMN <> 1 AND COLUMN <> 2 AND COLUMN <> 4 AND COLUMN <> 10 AND COLUMN <> 11
AND COLUMN <> 12 AND COLUMN <> 13  AND COLUMN <> 15 ORDER BY REC_NUM
                244093 Query    ROLLBACK
                245133 Init DB  DB_NAME
                245133 Query    SELECT COLUMN FROM TABLE WHERE COLUMN = 'DB_NAME'
                245133 Query    ROLLBACK
                245248 Query    ROLLBACK
                244093 Init DB  DB_NAME
                245133 Init DB  DB_NAME

到目前为止,该方法很好,但是问题在于它不适用于PreferenceCategory。

这是否意味着PreferenceCategory上的左填充不是图标的空格?

2 个答案:

答案 0 :(得分:5)

使用首选项xml中的app:iconSpaceReserved =“ false”(在每个项目下)解决。

    <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>

答案 1 :(得分:2)

这是一个错误,已经解决。您需要等待更新

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