gpt4 book ai didi

android - 如何通过XML启动Language和Input Intent?

转载 作者:行者123 更新时间:2023-11-30 01:36:17 24 4
gpt4 key购买 nike

<intent android:action="android.provider.Settings.ACTION_INPUT_METHOD_SETTINGS"/>不再工作了。我找到了答案 here .

Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
ComponentName com = new ComponentName("com.android.settings", "com.android.settings.LanguageSettings");
intent.setComponent(com); startActivity(intent);

但问题是我需要找到等效代码以通过 XML 启动此 Intent 。这可能吗?

最佳答案

没关系,我找到了答案 here .由于

android:targetClass

是组件名称的类部分,根据 setComponent() 方法。和

android:targetPackage 

根据 setComponent() 方法,组件名称的包部分。

也根据this ,

ComponentName(String package, String class)

因此等效的 XML 代码是:

<intent android:action="android.intent.action.MAIN"
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.LanguageSettings" />

虽然和先生一样CommonsWare说,不建议使用这种方法(阅读他对我的原始帖子的评论)。但是对于那些仍然想使用这种方法的人来说,继续吧。希望这会有所帮助:)

关于android - 如何通过XML启动Language和Input Intent?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35068663/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com