當前位置:首頁 » 安卓系統 » android快捷圖標

android快捷圖標

發布時間: 2023-08-07 19:28:29

❶ android 為什麼桌面快捷圖標不能改變

有3中解決辦法:1。可能是存儲卡意外拔出,你重啟一下。
2。個性化設置---皮膚---隨便選個應用
3。點設置-語言和鍵盤-中文—(繁體){就是換個語言}
之後桌面圖標就變回來了。而且最後再改成簡體也還是有圖標的。
安卓手機桌面快捷方式的圖標變成了機器人的原因:
安卓手機開機之後,系統開始載入桌面圖標,但是這是有先後順序的,開機之後可以看到這樣的畫面:程序圖標出現的順序是有先後的。
同樣,載入手機自身存儲里的軟體和載入SD卡里的軟體也是有順序的(先自身存儲再SD卡了)所以,會出現SD卡里的程序的桌面圖標變成小綠人。一般是因為還在載入的緣故,並沒有什麼大不了的,過一段時間,等載入完成後,圖標自然就會回來了

❷ 安卓手機怎麼添加網頁的快捷方式到桌面

通過瀏覽器菜單,添加「桌面書簽」功能來實現。具體操作如下。

1)打開華為瀏覽器,登陸手機新浪網。

❸ Android創建桌面快捷方式(兼容Android 8.0)

在Android O原生桌面上,按照傳統創建快捷方式的形式,是不會產生快捷方式的。

傳統方式如下:

從Android 7.1(API 25)開始,新增了ShortcutManager,可以對桌面久按應用圖標彈出的快捷方式進行管理。

但是,Android 7.1上直接往桌面上添加快捷方式依然是使用上面說到的這種舊方式,但是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 introced 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 com.android.launcher.action.INSTALL_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版本上運行,因為它們回落到不推薦使用的私有意圖com.android.launcher.action.INSTALL_SHORTCUT。

ShortcutManager類在API level 26上,增加了對isRequestPinShortcutSupported、requestPinShortcut、createShortcutResultIntent三個方法。說明如下:

1.isRequestPinShortcutSupported

官文:
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 com.android.launcher.action.INSTALL_SHORTCUT.

譯:
如果默認桌面支持requestPinShortcut(ShortcutInfo,IntentSender)方法,則返回TRUE。

如果用戶更改默認啟動程序應用程序,返回值可能會在後續調用中更改。

注意:另請參見支持庫對應的isRequestPinShortcutSupported(Context),在低於O的Android版本,它支持使用舊的私有意圖com.android.launcher.action.INSTALL_SHORTCUT。

2.requestPinShortcut

官文:
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 com.android.launcher.action.INSTALL_SHORTCUT.

譯:
請求創建固定的快捷方式。默認啟動器將收到該請求,並要求用戶批准。如果用戶批准,將創建快捷方式,並且將發送resultIntent。但是,如果請求被用戶拒絕,則不會向呼叫者發送任何響應。

只有具有前台活動或前台服務的應用程序才能調用此方法。否則,它將拋出IllegalStateException。

當同一個軟體包連續多次調用該API時,由開發人員決定如何處理以前的待處理請求。一個可能的策略是忽略任何先前的請求。

注意:另請參見支持庫對應件requestPinShortcut(Context,ShortcutInfoCompat,IntentSender),在低於O的Android版本,它支持使用舊的私有意圖com.android.launcher.action.INSTALL_SHORTCUT。

3.createShortcutResultIntent

官文:
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進行快捷方式的版本適配。於是,在build.gradle中添加依賴進行嘗試:

熱點內容
linux嵌入式書籍 發布:2025-02-04 03:44:07 瀏覽:331
sql分組最後一條 發布:2025-02-04 03:38:24 瀏覽:269
單宮數字奇門演算法 發布:2025-02-04 03:33:57 瀏覽:861
文件夾盒子 發布:2025-02-04 03:33:05 瀏覽:109
python教案 發布:2025-02-04 03:10:38 瀏覽:798
怎麼編程套料 發布:2025-02-04 02:50:31 瀏覽:208
副編譯 發布:2025-02-04 02:05:25 瀏覽:613
解壓按摩師 發布:2025-02-04 01:21:31 瀏覽:424
linuxssh限制 發布:2025-02-04 01:20:40 瀏覽:697
腳本式是什麼 發布:2025-02-04 01:06:24 瀏覽:248