为什么PreferenceScreen在sdk版本28中无法正确显示?怎么解决呢?

时间:2018-09-02 17:34:55

标签: android preferencescreen

implementation "com.android.support:appcompat-v7:28.0.0-rc01"
implementation "com.android.support:preference-v14:28.0.0-rc01"

这是我build.gradle中的代码。我编写了settings_pref.xml。它在Android Studio和我的手机中无法正确显示。

这是settings_pref.xml。

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <PreferenceCategory
        android:title="@string/settings_about">

        <Preference
            android:title="@string/settings_version"
            app:key="version"
            android:summary="%s"/>

        <Preference
            android:title="@string/settings_rate"
            app:key="rate"
            android:summary="@string/settings_rate_desc"/>

        <Preference
            android:title="@string/settings_licenses"
            app:key="licenses"/>

    </PreferenceCategory>

    <PreferenceCategory
        android:title="@string/settings_thanks">
        <Preference
            android:title="@string/settings_lizhaotailang"
            app:key="lizhaotailang"
            android:summary="@string/settings_lizhaotailang_desc"/>
        <Preference
            android:title="@string/settings_hongyang"
            app:key="hongyang"
            android:summary="@string/settings_hongyang_desc"/>
    </PreferenceCategory>

    <PreferenceCategory
        android:title="@string/settings_support">
        <Preference
            android:title="@string/settings_source_code"
            app:key="source_code"
            android:summary="@string/settings_source_code_link"/>
        <Preference
            android:title="@string/settings_send_advices"
            app:key="send_advice"
            android:summary="@string/settings_send_advices_desc"/>
    </PreferenceCategory>

</PreferenceScreen>

这是strings.xml

<!-- Settings start -->
    <string name="settings_about">About</string>
    <string name="settings_version">Version</string>
    <string name="settings_rate">Rate</string>
    <string name="settings_rate_desc">If you like this app, please do rate it.</string>
    <string name="settings_licenses">Licenses</string>
    <string name="settings_thanks">Thanks</string>
    <string name="settings_lizhaotailang">Li Zhao Tai Lang</string>
    <string name="settings_lizhaotailang_desc">Appreciate his help very much</string>
    <string name="settings_lizhaotailang_link">https://github.com/TonnyL</string>
    <string name="settings_hongyang">Hong Yang</string>
    <string name="settings_hongyang_desc">API provider</string>
    <string name="settings_hongyang_link">https://github.com/hongyangAndroid</string>
    <string name="settings_support">Support</string>
    <string name="settings_source_code">GitHub Source code</string>
    <string name="settings_source_code_link">https://xxxxxxx</string>
    <string name="settings_send_advices">Send advices</string>
    <string name="settings_send_advices_desc">Help me improve this app</string>
    <string name="settings_mail_account">mailto:719952215@qq.com</string>
    <string name="settings_device_model">Device Version:</string>
    <string name="settings_mail_topic">WanAndroid Advices</string>
    <string name="settings_sdk_version">SDK Version:</string>
    <!-- Settings end -->

incorrect_img

如果我更改了低于28.0.0的支持库版本,如下所示:

implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.android.support:preference-v14:27.1.1"

它正确显示。

correct_img

我该怎么解决?如果我不想更改我的支持库版本:28.0.0-rc01?

0 个答案:

没有答案