@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED"; 解决此问题的关键是在合适的时候和位置添加处理系统在切换语言后发出的广播信息。 比如你有一个IntentFilter,那么你要把ACTION_LOCALE_CHANGED添加到里面。 你要注册一...
于是断定LocalePicker就是语言设置的Fragment,它是ListFragment的子类,继承于framework中LocalePicker,并实现了父类的一个接口,其回调方法是onLocaleSelected(),Locale中文含义大致是语言环境,所以可推测这是设置语言后的一个回调方法,不确定的话,可打断点测试一下。然而此类中并没有关于语言设置界面数据适配的太多逻辑,只...
Intent.ACTION_LOCALE_CHANGED 广播,在重启 Activity 之前修改 APP 全局的 Configuration。 如果对应的 Activity 设置了 android:configChanges=”locale” 则可以直接在 Activity.onConfigurationChanged(Configuration newConfig) 中响应 Configuration 的变化。如果无效,请参《android:configChanges locale 改语言后,该配置不起...
LOCALE_CHANGEDAndroid 會在 android.intent.action.LOCALE_CHANGED 用戶變更其語言選取專案時產生。活動可以選擇在活動上設定 android:configChanges 屬性來處理此動作,如下所示:C# 複製 [Activity (Label = "@string/app_name", MainLauncher = true, Icon="@drawable/launcher", ConfigurationChanges = ConfigChanges...
super.onConfigurationChanged(warp.getApplicationContext().getResources().getConfiguration()); } 上面对应的方法在这里面,而LanUtils.getTargetLable()则是我记录的,已经切换的locale的记录对象,这个小伙伴们可以自行实现。下述方法因为还有其他地方用得到,所以我进行封装 ...
LanguageUtil.setLanguage(savedLanguage); } } } 2.在 MainActivity 中 @Override onNewIntent()这个方法 , 如果不重写,当launch mode 为single task 时不会刷新 @OverrideprotectedvoidonNewIntent(Intent intent) {if(intent.getAction() == "language changed") { ...
Intent.ACTION_LOCALE_CHANGED 广播,在重启 Activity 之前修改 APP 全局的 Configuration。 如果对应的 Activity 设置了 android:configChanges="locale" 则可以直接在 Activity.onConfigurationChanged(Configuration newConfig) 中响应 Configuration 的变化。如果无效,请参《android:configChanges locale 改语言后,该配置不起...
1、 使用Action跳转,当程序AndroidManifest.xml中某一个 Activity的IntentFilter定义了包含Action,如果恰好与目标Action匹配,且其IntentFilter中没有定义其它的Type或Category过滤条件,那么就正好匹配了。如果手机中有两个以上的Action程序匹配...
LOCALE_CHANGED Android 會在android.intent.action.LOCALE_CHANGED用戶變更其語言選取專案時產生。 活動可以選擇在活動上設定android:configChanges屬性來處理此動作,如下所示: C#複製 [Activity (Label ="@string/app_name", MainLauncher = true, Icon="@drawable/launcher", ConfigurationChanges = ConfigChanges.Local...
ActionGetRestrictionEntries ActionGtalkServiceConnected ActionGtalkServiceDisconnected ActionHeadsetPlug ActionInputMethodChanged ActionInsert ActionInsertOrEdit ActionInstallFailure ActionInstallPackage ActionLaunchCaptureContentActivityForNote ActionLocaleChanged ActionLockedBootCompleted ActionMain ActionManagedProfileAdded Ac...