我们的app支持18种语言,为了测试能很快的跳转到语言的切换页面.所以专门扒拉了一下intent跳转系统所有设置页面的方法,记录下来,以后忘记了可以直接查看.
就是这么漂,就是这么酷炫~
android.provider.Settings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
| 1. ACTION_ACCESSIBILITY_SETTINGS :
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); startActivity(intent);
2. ACTION_ADD_ACCOUNT :
Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT); startActivity(intent);
3. ACTION_AIRPLANE_MODE_SETTINGS:
Intent intent = new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS); startActivity(intent);
或者:
ACTION_WIRELESS_SETTINGS :
Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); startActivity(intent);
4. ACTION_APN_SETTINGS:
Intent intent = new Intent(Settings.ACTION_APN_SETTINGS); startActivity(intent);
5. 【需要参数】 ACTION_APPLICATION_DETAILS_SETTINGS:
Uri packageURI = Uri.parse("package:" + "com.tencent.WBlog"); Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,packageURI); startActivity(intent);
6. ACTION_APPLICATION_DEVELOPMENT_SETTINGS :
Intent intent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS); startActivity(intent);
7. ACTION_APPLICATION_SETTINGS :
Intent intent = new Intent(Settings.ACTION_APPLICATION_SETTINGS); startActivity(intent);
或者:
ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS
Intent intent = new Intent(Settings.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS); startActivity(intent);
或者:
ACTION_MANAGE_APPLICATIONS_SETTINGS :
Intent intent = new Intent(Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS); startActivity(intent);
8. ACTION_BLUETOOTH_SETTINGS :
Intent intent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS); startActivity(intent);
9. ACTION_DATA_ROAMING_SETTINGS :
Intent intent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS); startActivity(intent);
10. ACTION_DATE_SETTINGS :
Intent intent = new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS); startActivity(intent);
11. ACTION_DEVICE_INFO_SETTINGS :
Intent intent = new Intent(Settings.ACTION_DEVICE_INFO_SETTINGS); startActivity(intent);
12. ACTION_DISPLAY_SETTINGS :
Intent intent = new Intent(Settings.ACTION_DISPLAY_SETTINGS); startActivity(intent);
13. ACTION_DREAM_SETTINGS 【API 18及以上 没测试】
Intent intent = new Intent(Settings.ACTION_DREAM_SETTINGS); startActivity(intent);
14. ACTION_INPUT_METHOD_SETTINGS :
Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS); startActivity(intent);
15. ACTION_INPUT_METHOD_SUBTYPE_SETTINGS 【API 11及以上】
Intent intent = new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS); startActivity(intent);
16. ACTION_INTERNAL_STORAGE_SETTINGS
Intent intent = new Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS); startActivity(intent);
或者:
ACTION_MEMORY_CARD_SETTINGS :
Intent intent = new Intent(Settings.ACTION_MEMORY_CARD_SETTINGS); startActivity(intent);
17. ACTION_LOCALE_SETTINGS :
Intent intent = new Intent(Settings.ACTION_LOCALE_SETTINGS); startActivity(intent);
18. ACTION_LOCATION_SOURCE_SETTINGS :
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(intent);
19. ACTION_NETWORK_OPERATOR_SETTINGS :
Intent intent = new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS); startActivity(intent);
20. ACTION_NFCSHARING_SETTINGS :
Intent intent = new Intent(Settings.ACTION_NFCSHARING_SETTINGS); startActivity(intent);
21. ACTION_NFC_SETTINGS :
Intent intent = new Intent(Settings.ACTION_NFC_SETTINGS); startActivity(intent);
22. ACTION_PRIVACY_SETTINGS :
Intent intent = new Intent(Settings.ACTION_PRIVACY_SETTINGS); startActivity(intent);
23. ACTION_QUICK_LAUNCH_SETTINGS :
Intent intent = new Intent(Settings.ACTION_QUICK_LAUNCH_SETTINGS); startActivity(intent);
24. ACTION_SEARCH_SETTINGS :
Intent intent = new Intent(Settings.ACTION_SEARCH_SETTINGS); startActivity(intent);
25. ACTION_SECURITY_SETTINGS :
Intent intent = new Intent(Settings.ACTION_SECURITY_SETTINGS); startActivity(intent);
26. ACTION_SETTINGS :
Intent intent = new Intent(Settings.ACTION_SETTINGS); startActivity(intent);
27. ACTION_SOUND_SETTINGS
Intent intent = new Intent(Settings.ACTION_SOUND_SETTINGS); startActivity(intent);
28. ACTION_SYNC_SETTINGS :
Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS); startActivity(intent);
29. ACTION_USER_DICTIONARY_SETTINGS :
Intent intent = new Intent(Settings.ACTION_USER_DICTIONARY_SETTINGS); startActivity(intent);
30. ACTION_WIFI_IP_SETTINGS :
Intent intent = new Intent(Settings.ACTION_WIFI_IP_SETTINGS); startActivity(intent);
31. ACTION_WIFI_SETTINGS :
Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); startActivity(intent);
|
跳转方式
1 2
| Intent intent = new Intent(Settings.*********); startActivity(intent);
|
举个例子
方法都贴完了怎么能不举个栗子,撸码爽爽
MainActivity.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| import android.content.Intent; import android.provider.Settings; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Settings.ACTION_LOCALE_SETTINGS); startActivity(intent); } }); } }
|
activity_main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent">
<Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="语言选择"/> </android.support.constraint.ConstraintLayout>
|
实现效果