如何在Android中使用Intent以编程方式打开家庭启动器列表设置屏幕 [英] How to open Home Launcher List settings screen programmatically in Android using Intent

查看:78
本文介绍了如何在Android中使用Intent以编程方式打开家庭启动器列表设置屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种使用Intent在系统设置的主页"选项中打开启动器列表屏幕的方法.

I am looking for a way to open a Launcher list screen in Home option in system Settings using Intent.

主系统设置>>主页>>启动器列表.

main system Settings >> Home >> Launcher List.

我需要使用Intent打开此启动器列表屏幕.如果有人能指出正确的方向,我将不胜感激.非常感谢.

I need to open this Launcher list screen using Intent. If anyone could point me in the right direction I would really appreciate it. Thanks much.

推荐答案

要显示主屏幕设置页面,请调用Settings.ACTION_HOME_SETTINGS意图.但是,仅在API 21及更高版本中支持此功能.

To bring up the home screen settings page, call the Settings.ACTION_HOME_SETTINGS intent. However this is ONLY supported in API 21 and above.

API 20及以下版本需要调用Settings.ACTION_SETTINGS意图,并且用户必须浏览其余方式. (最好是事先有说明)

API 20 and below need to call the Settings.ACTION_SETTINGS intent, and the user must navigate the rest of the way. (Preferably with instructions before hand)

要在可能的情况下提供最佳意图,请使用以下代码.这将直接在API 21及更高版本上打开主页设置,否则将在API 20及更低版本上打开设置页面.

To provide the best intent when available, use the following code. This will open the home settings directly on API 21 and above, else it will open the settings page on API 20 and below.

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
    final Intent intent = new Intent(Settings.ACTION_HOME_SETTINGS);
    startActivity(intent);
}
else {
    final Intent intent = new Intent(Settings.ACTION_SETTINGS);
    startActivity(intent);
}

这篇关于如何在Android中使用Intent以编程方式打开家庭启动器列表设置屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆