安卓手机快捷键在哪里设置

安卓手机快捷键在哪里设置,第1张

1、首先进入手机设置。

2、然后找到更多设置点击进入。

3、再点击进入按键快捷方式选项。

4、进入之后,即可在此按自己的喜好设置快捷键了。

打开设置,以我的手机为例,如图

打开网络分享和便携式热点

便携式wlan打开,就好了,设置一下密码和名称,就可以收到了,但是前提是得把你的移动网络打开哈。

进入所有程序的菜单,在上面有“应用程序”和“桌面小工具”,有两种办法:

1、找到“手电筒”这个应用的图标,按住它不动,这时会自动返回桌面。然后你就把图标拖到你想的位置松开就可以了。

2、如果你的“手电筒”应用有桌面小工具的话,就向右滑动“所有程序”滑到“桌面小工具”处,找到“手电筒”的桌面小工具‘也是按住并拖到桌面上。

在Android O原生桌面上,按照传统创建快捷方式的形式,是不会产生快捷方式的。

传统方式如下:

从Android 71(API 25)开始,新增了ShortcutManager,可以对桌面久按应用图标弹出的快捷方式进行管理。

但是,Android 71上直接往桌面上添加快捷方式依然是使用上面说到的这种旧方式,但是Android O上,Google应该是想通过比较统一的接口来管理桌面快捷方式了,所以摒弃了这种形式,转而使用ShortcutManager进行管理。所以API 26上,ShortcutManager进行管理。所以API 26上,ShortcutManager新增了对Pinned Shortcuts(固定快捷方式)的管理。

官文:

Apps can pin an existing shortcut (either static or dynamic) or an entirely new shortcut to a supported launcher programatically using requestPinShortcut(ShortcutInfo, IntentSender) You pass two arguments into this method:

A ShortcutInfo object – If the shortcut already exists, this object should contain only the shortcut’s ID Otherwise, the new ShortcutInfo object must contain an ID, an intent, and a short label for the new shortcut

A PendingIntent object – This intent represents the callback that your app receives if the shortcut is successfully pinned to the device’s launcher

Note: If the user doesn’t allow the shortcut to be pinned to the launcher, the pinning process fails, and the Intent object that is passed into this PendingIntent object isn’t executed

Note: Due to background execution limits introduced in Android O, it’s best to use a manifest-declared receiver to receive a callback

Also, to prevent other apps from invoking the receiver, add the attribute assignment android:exported=”false” to the receiver’s manifest entry

Note: As you add logic in your app to make requests to pin shortcuts, keep in mind that not all launchers support pinning of shortcuts To determine whether your app can complete this process on a particular device, check the return value of isRequestPinShortcutSupported() Based on this return value, you might decide to hide the option in your app that allows users to pin a shortcut

Note: See also the support library APIs isRequestPinShortcutSupported(Context) and requestPinShortcut(Context, ShortcutInfoCompat, IntentSender), which works on Android versions lower than O by falling back to the deprecated private intent comandroidlauncheractionINSTALL_SHORTCUT

译:

应用程序可以使用requestPinShortcut(ShortcutInfo,IntentSender)将现有的快捷方式(静态或动态)或全新的快捷方式固定到支持的启动器。你通过这个方法的两个参数:

ShortcutInfo对象 - 如果快捷方式已存在,则该对象应仅包含快捷方式的ID。否则,新的ShortcutInfo对象必须包含新快捷方式的ID,意图和短标签。

PendingIntent对象 - 此意图表示如果快捷方式成功固定到设备的启动器,您的应用程序将收到回调。

注意:如果用户不允许将快捷方式固定在启动器上,则固定进程将失败,并且未执行传入此PendingIntent对象的Intent对象。

注意:由于Android O中引入的后台执行限制,最好使用清单声明的接收器来接收回调。

另外,为了防止其他应用程序调用接收器,将属性赋值android:exported =“false”添加到接收者的清单条目中。

注意:当您在应用程序中添加逻辑以引导快捷方式时,请记住,并非所有启动器都支持固定快捷方式。 要确定您的应用程序是否可以在特定设备上完成此过程,请检查isRequestPinShortcutSupported()的返回值。 根据此返回值,您可以决定隐藏您应用程序中允许用户固定快捷方式的选项。

注意:另请参见支持库API isRequestPinShortcutSupported(Context)和requestPinShortcut(Context,ShortcutInfoCompat,IntentSender),它可以在低于O的Android版本上运行,因为它们回落到不推荐使用的私有意图comandroidlauncheractionINSTALL_SHORTCUT。

ShortcutManager类在API level 26上,增加了对isRequestPinShortcutSupported、requestPinShortcut、createShortcutResultIntent三个方法。说明如下:

1isRequestPinShortcutSupported

官文:

Return TRUE if the app is running on a device whose default launcher supports requestPinShortcut(ShortcutInfo, IntentSender)

The return value may change in subsequent calls if the user changes the default launcher app

Note: See also the support library counterpart isRequestPinShortcutSupported(Context), which supports Android versions lower than O using the legacy private intent comandroidlauncheractionINSTALL_SHORTCUT

译:

如果默认桌面支持requestPinShortcut(ShortcutInfo,IntentSender)方法,则返回TRUE。

如果用户更改默认启动程序应用程序,返回值可能会在后续调用中更改。

注意:另请参见支持库对应的isRequestPinShortcutSupported(Context),在低于O的Android版本,它支持使用旧的私有意图comandroidlauncheractionINSTALL_SHORTCUT。

2requestPinShortcut

官文:

Request to create a pinned shortcut The default launcher will receive this request and ask the user for approval If the user approves it, the shortcut will be created, and resultIntent will be sent If a request is denied by the user, however, no response will be sent to the caller

Only apps with a foreground activity or a foreground service can call this method Otherwise, it’ll throw IllegalStateException

It’s up to the launcher to decide how to handle previous pending requests when the same package calls this API multiple times in a row One possible strategy is to ignore any previous requests

Note: See also the support library counterpart requestPinShortcut(Context, ShortcutInfoCompat, IntentSender), which supports Android versions lower than O using the legacy private intent comandroidlauncheractionINSTALL_SHORTCUT

译:

请求创建固定的快捷方式。默认启动器将收到该请求,并要求用户批准。如果用户批准,将创建快捷方式,并且将发送resultIntent。但是,如果请求被用户拒绝,则不会向呼叫者发送任何响应。

只有具有前台活动或前台服务的应用程序才能调用此方法。否则,它将抛出IllegalStateException。

当同一个软件包连续多次调用该API时,由开发人员决定如何处理以前的待处理请求。一个可能的策略是忽略任何先前的请求。

注意:另请参见支持库对应件requestPinShortcut(Context,ShortcutInfoCompat,IntentSender),在低于O的Android版本,它支持使用旧的私有意图comandroidlauncheractionINSTALL_SHORTCUT。

3createShortcutResultIntent

官文:

Returns an Intent which can be used by the default launcher to pin a shortcut containing the given ShortcutInfo This method should be used by an Activity to set a result in response to ACTION_CREATE_SHORTCUT

译:

返回默认启动器可以使用的Intent来固定包含给定的ShortcutInfo的快捷方式。 Activity应该使用此方法来设置响应ACTION_CREATE_SHORTCUT的结果。

根据弹窗提示可以看出,可以通过拖动这个图标往桌面上添加快捷方式,可以通过点击自动添加按键,系统给你在桌面的默认位置上添加。

添加后,桌面上会出现如图所示的图标:

回调用到的Receiver:

打印log发现,onReceive如图官方文档所说,点击弹框自动添加按键后,会得到回调。但实践发现,如果桌面上已经添加了图标,当再次调用requestPinShortcut进行添加时,onReceive会在调用requestPinShortcut的时候,直接被回调,而且弹框也会弹出来。

在以上三个方法官方介绍中,官方提示我们,可以使用Android support库的ShortcutManagerCompat进行快捷方式的版本适配。于是,在buildgradle中添加依赖进行尝试:

您是想创建文件的快捷方式吗?将经常访问的文件添加到桌面快捷方式,方便随手打开。1打开“”“文件管理”。

2在“本地”页签下,点击“内部存储”或“ SD 卡”。

3长按要设置桌面快捷方式的文件,然后点击“ > 桌面快捷方式”。

欢迎分享,转载请注明来源:品搜搜测评网

原文地址:https://pinsoso.cn/shuma/933521.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-08-17
下一篇2023-08-17

随机推荐

  • 妮维雅止汗露 喷雾与走珠 哪个效果更好?

    我觉得两种应该都是差不多的效果,仅仅是在使用方法上有所不同。如果你光用在腋下可以只用走珠,如果你既要用在腋下,又要用在其他部位就可以用喷雾!!!妮维雅的我觉得持续的时间都是比较短的,需要每天都用。止汗露我觉得还是不要天天用哦!!推荐我最近买

    2024-04-15
    65600
  • 雪花秀10件套翻译图片,雪花秀套盒怎么查询是否是正品

    雪花秀是这几年在国内热度以及知名度都很不错的韩国品牌,虽然旗下的产品有很多,但最近大家比较喜欢的还是他们家的雪花秀10件套装,下面就是雪花秀10件套翻译,雪花秀套盒怎么查询是否是正品的方法介绍,一起来看看。雪花秀10件套主要有:滋阴水2件(

    2024-04-15
    41500
  • 小乌龟用什么东西来装着养

    小龟可以毫无困难地用一个平底容器饲养,塑胶盆,塑胶槽,玻璃缸或盒、水族箱都很合适,水不要太深,深度能让其游泳为好。  一个理想的养育场所须有一些特定最低要件。每只幼龟要有五公升水的活动空间,而水深不应超过龟体长度,好让龟到水面呼吸时脚能撑到

    2024-04-15
    41400
  • 最近有什么平价而且好用的洗面奶推荐吗?

    国内外洗护用品品牌也是非常多的,其中不乏有一些优秀的产品。洗面奶是每一位爱洁净的男性女性都很常有的脸部清洁产品,接下来我将给大家介绍几款性价比高的洗面奶,让我们一起来看看吧。1、旁氏米粹润泽洁面乳参考价格:39元作为一款氨基酸洗面奶,旁氏米

    2024-04-15
    40800
  • 清莹露和神仙水的区别

    清莹露和神仙水的区别为价格区别、外观区别、功效区别、适用人群不同、效果区别。1、成分区别:神仙水是由半乳糖酵母的发酵物过滤液组成,除了丁二醇和其它润肤成份之外,没有其它有效成份。清莹露是用水做溶剂,加入了酵母、甘油、适量的乳化剂和酸类,水杨

    2024-04-15
    46400
  • 在那能买到正品的妮维雅止汗珠

    您好,止汗珠属于爽身香体的一种,让爽身香体专家——舒耐来为您解答吧!一般的爽身香体产品在全国的屈臣氏、万宁及家乐福等大型卖场都有售卖,如果你所在的地区没有这些门店的话,建议你可以上品牌天猫旗舰店、京东或者1号店购买,期待您对舒耐的关注!很抱

    2024-04-15
    46500
  • 问一问:妮维雅小蓝罐唇膏真假如何鉴别呢?

    妮维雅小蓝罐唇膏的鉴定妮维雅小蓝罐唇膏真假妮维雅小蓝罐唇膏真正的设计:正品上有蜂窝图案,一共8个。假货忽略了这个图标,说明口红含有蜂胶。正品口红底部的图案有花王有限公司、产地、电话、生产批号等信息。下面。仿制假货往往会有疏漏,可以参考鉴别。

    2024-04-15
    40200

发表评论

登录后才能评论
保存