我应该在 xml 中隐藏首选项。这是一个例子。
我不需要删除整个功能,而是需要隐藏第二个首选项,它是top_level_connected_devices
xml 中的关键。我正在使用安卓 10。
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="top_level_settings">
<Preference
android:key="@string/category_key_wireless"
android:title="@string/interface_settings"
android:icon="@drawable/ic_settings_interface"
android:order="-120"
android:fragment="com.android.settings.InterfaceSettings"/>
<Preference
android:key="top_level_connected_devices"
android:title="@string/connected_devices_dashboard_title"
android:summary="@string/summary_placeholder"
android:icon="@drawable/ic_homepage_connected_device"
android:order="-110"
android:fragment="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment"
settings:controller="com.android.settings.connecteddevice.TopLevelConnectedDevicesPreferenceController"/>
</PreferenceScreen>