一 : 截自Settings模块中的移动网络
<!-- android:disableDependentsState="true"反向依赖关系-->
<SwitchPreference
android:key="toggle_airplane"
android:title="@string/airplane_mode"
android:persistent="false"
android:disableDependentsState="true" />
<SwitchPreference
android:key="toggle_nfc"
android:title="@string/nfc_quick_toggle_title"
android:summary="@string/nfc_quick_toggle_summary"
android:persistent="false" />
<PreferenceScreen
android:key="wifi_calling_settings"
android:title="@string/wifi_calling_settings_title"
settings:keywords="@string/keywords_wifi_calling"
android:fragment="com.android.settings.WifiCallingSettings" />
<PreferenceScreen
android:fragment="com.android.settings.nfc.AndroidBeam"
android:key="android_beam_settings"
android:title="@string/android_beam_settings_title" />
<PreferenceScreen
android:fragment="com.android.settings.TetherSettings"
android:key="tether_settings"
android:title="@string/tether_settings_title_all" />
<PreferenceScreen
android:fragment="com.android.settings.vpn2.VpnSettings"
android:key="vpn_settings"
android:title="@string/vpn_settings_title" />
<!-- android:dependency="toggle_airplane 关联toggle_airplane飞行模式-->
<PreferenceScreen
android:key="mobile_network_settings"
android:title="@string/network_settings_title"
settings:keywords="@string/keywords_more_mobile_networks"
android:enabled="false"
android:dependency="toggle_airplane">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.android.phone"
android:targetClass="com.android.phone.MobileNetworkSettings" />
</PreferenceScreen>
mobile_network_settings受toggle_airplane控制, android:disableDependentsState=”true”反向控制。