error when PreferenceActivity


check this article:
https://blog.30sparks.com/preferenceactivity-under-appcompat/

不過要注意Setting layout .xml 內Toolbar要改:

xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"              android:layout_width="match_parent"              android:layout_height="match_parent"              android:orientation="vertical">
   
   <androidx.appcompat.widget.Toolbar         android:id="@+id/action_bar"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:minHeight="?attr/actionBarSize" />
   
   <FrameLayout         android:id="@+id/content_wrapper"         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="1" />

</LinearLayout>