androidandroidxpreferencescreenandroid-9.0-pie

Divider between PreferenceScreen's


After migrating to AndroidX and upping target SDK to 28 my SettingsPage has lost the dividers between the PreferenceScreen components and the text is not left aligned. Can anyone help?

`

<PreferenceScreen android:title="@string/dummy_string_1">
    <intent
        android:action="android.intent.action.VIEW"
        android:targetPackage="@string/app_package_name" />
</PreferenceScreen>

<PreferenceScreen android:title="@string/dummy_string_2">

    <intent
        android:action="android.intent.action.VIEW"
        android:targetPackage="@string/app_package_name" />

</PreferenceScreen>

<PreferenceScreen android:title="@string/dummy_string_3">

    <intent
        android:action="android.intent.action.VIEW"
        android:targetPackage="@string/app_package_name" />

</PreferenceScreen>

`

This is how it looks now, without dividers and text is not left aligned


Solution

  • Create your own layout with a divider and then add the folowing tag:

    android:layout="@layout/divider_preference"