android 預置案頭上的應用程式圖示、捷徑表徵圖或者視窗小組件

來源:互聯網
上載者:User

標籤:android   http   io   ar   sp   on   檔案   bs   cti   

請修改res/xml/default_workspace.xml檔案,添加如下代碼:
<favorite
        launcher:packageName="" //完整的包名
        launcher:className=""      //完整包名.類名(處理main intent的類)
        launcher:screen=""            //應用表徵圖所在的螢幕(從0開始)
        launcher:x=""                    //應用表徵圖所在的列
        launcher:y="" />                //應用表徵圖所在的行
<shortcut
        launcher:uri="http://www.baidu.com"
        launcher:icon="@drawable/ic_launcher_baidu"
        launcher:title="@string/baidu_title"
        launcher:screen=""
        launcher:x=""
        launcher:y="" />
<shortcut              
   launcher:uri="#Intent;action=android.intent.action.MAIN;launchFlags=0x10200000;component=com.cleanmaster.mguard/com.cleanmaster.processcleaner.ProcessCleanerActivity;end"
        launcher:icon="@drawable/ic_launcher_application"
        launcher:title="@string/jinshan_title" 
        launcher:screen=""
        launcher:x=""
        launcher:y=""/>
 <appwidget
        launcher:packageName="com.android.settings"
        launcher:className="com.android.settings.widget.SettingsAppWidgetProvider"
        launcher:screen="3"
        launcher:x="0"
        launcher:y="0"
        launcher:spanX="4"  //在螢幕上x方向所佔的格子數
        launcher:spanY="1" //在螢幕上y方向所佔格子數 />
 


1、不能預置有configuration的AppWidget。
2、Google從KK開始對系統許可權增加限制,對於system許可權的擷取有嚴格的規範。Launcher3預設拿不到系統BIND_APPWIDGET許可權,因此無法預置AppWidget。
如果要預置AppWidget,需要Launcher3擷取到系統許可權,因此要修改Launcher3的Android.mk,增加LOCAL_PRIVILEGED_MODULE := true,這樣build出來的Launcher3.apk會產生到/system/priv-app目錄下,可以預置appwidget。
具體代碼撰寫如下:
 
3、如果是電訊廠商項目,會有resource_overlay機制,以OP01/SPEC0200/SEGC為例,案頭預置內容是以如下路徑的default_workspace.xml為準:
ICS/ICS2: alps/mediatek/source/operator/OP01/SPEC0200/SEGC/OverLayResource/packages/apps/Launcher2/res/xml/default_workspace.xml
JB/JB2: alps/mediatek/operator/OP01/SPEC0200/SEGC/OverLayResource/packages/apps/Launcher2/res/xml/default_workspace.xml
其他電訊廠商項目與此類似。

android 預置案頭上的應用程式圖示、捷徑表徵圖或者視窗小組件

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.