如何在android4.4上添加未读信息,未接来电或日历新事件提醒等功能
1个回答
2015-02-13 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:117538
获赞数:517195
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注
展开全部
详细修改如下:
1.首先准备各种大小的ic_newevents_numberindication.9.png图片,这个自己去找吧
,如果你是搞开发的,在以前的项目中都可以找到的。
2.定义个未读信息支持的app事件xml,我这个支持短信,日历,电话,邮件:
b/packages/apps/Launcher3/res/xml/unread_support_shortcuts.xml
内容如下:
+<?xml version="1.0" encoding="UTF-8"?>
+<unreadshortcuts xmlns:launcher="http://schemas.android.com/apk/res-
auto/com.android.launcher3">
+
+ <shortcut
+ launcher:unreadPackageName="com.android.dialer"
+ launcher:unreadClassName="com.android.dialer.DialtactsActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_contacts_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.android.mms"
+ launcher:unreadClassName="com.android.mms.ui.BootActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_mms_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.android.email"
+ launcher:unreadClassName="com.android.email.activity.Welcome"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_email_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.android.calendar"
+ launcher:unreadClassName="com.android.calendar.AllInOneActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_calendar_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.orangelabs.rcs"
+
launcher:unreadClassName="com.mediatek.rcse.activities.ChatMainActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_rcse_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.android.cellbroadcastreceiver"
+
launcher:unreadClassName="com.android.cellbroadcastreceiver.CellBroadcastLis
tActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_calendar_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.mediatek.cellbroadcastreceiver"
+
launcher:unreadClassName="com.mediatek.cellbroadcastreceiver.CellBroadcastLi
stActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_mediatek_cellbroadcastreceiver_unread"
+ />
+</unreadshortcuts>
3.添加几种需要用到而之前没有的权限:
b/packages/apps/Launcher3/AndroidManifest.xml
<original-package android:name="com.android.launcher3" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
+ <uses-permission
android:name="android.permission.ADVANCED_WIDGET_API"/>
+ <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
+ <uses-permission android:name="android.permission.INSTALL_PACKAGES"/>
+ <uses-permission android:name="android.permission.DELETE_PACKAGES"/>
4.定义要用的字符串:b/packages/apps/Launcher3/res/values/attrs.xml
+ <!-- XML attributes used by unread_support_shortcuts.xml -->
+ <declare-styleable name="UnreadShortcut">
+ <attr name="unreadPackageName" format="string" />
+ <attr name="unreadClassName" format="string" />
+ <attr name="unreadKey" format="string" />
+ <attr name="unreadType" format="integer" />
+ </declare-styleable>
5.定义显示的数字大小尺寸,这个可以自己修改到满意,这个是四行五列排列的
1080*1920屏幕大小的尺寸。
b/packages/apps/Launcher3/res/values/dimens.xml
+ <!-- Add for unread events feature. -->
+ <dimen name="unread_minWidth">20dp</dimen>
+ <dimen name="hotseat_unread_margin_top">16dp</dimen>
+ <dimen name="hotseat_unread_margin_right">8dp</dimen>
+ <dimen name="folder_unread_margin_top">16dp</dimen>
+ <dimen name="folder_unread_margin_right">14dp</dimen>
+ <dimen name="workspace_unread_margin_top">16dp</dimen>
+ <dimen name="workspace_unread_margin_right">16dp</dimen>
+ <dimen name="app_list_unread_margin_top">20dp</dimen>
+ <dimen name="app_list_unread_margin_right">16dp</dimen>
+ <dimen name="unread_text_margin">8dp</dimen>
+ <dimen name="unread_text_number_size">14sp</dimen>
+ <dimen name="unread_text_plus_size">10sp</dimen>
1.首先准备各种大小的ic_newevents_numberindication.9.png图片,这个自己去找吧
,如果你是搞开发的,在以前的项目中都可以找到的。
2.定义个未读信息支持的app事件xml,我这个支持短信,日历,电话,邮件:
b/packages/apps/Launcher3/res/xml/unread_support_shortcuts.xml
内容如下:
+<?xml version="1.0" encoding="UTF-8"?>
+<unreadshortcuts xmlns:launcher="http://schemas.android.com/apk/res-
auto/com.android.launcher3">
+
+ <shortcut
+ launcher:unreadPackageName="com.android.dialer"
+ launcher:unreadClassName="com.android.dialer.DialtactsActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_contacts_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.android.mms"
+ launcher:unreadClassName="com.android.mms.ui.BootActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_mms_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.android.email"
+ launcher:unreadClassName="com.android.email.activity.Welcome"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_email_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.android.calendar"
+ launcher:unreadClassName="com.android.calendar.AllInOneActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_calendar_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.orangelabs.rcs"
+
launcher:unreadClassName="com.mediatek.rcse.activities.ChatMainActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_rcse_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.android.cellbroadcastreceiver"
+
launcher:unreadClassName="com.android.cellbroadcastreceiver.CellBroadcastLis
tActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_android_calendar_unread"
+ />
+ <shortcut
+ launcher:unreadPackageName="com.mediatek.cellbroadcastreceiver"
+
launcher:unreadClassName="com.mediatek.cellbroadcastreceiver.CellBroadcastLi
stActivity"
+ launcher:unreadType="0"
+ launcher:unreadKey="com_mediatek_cellbroadcastreceiver_unread"
+ />
+</unreadshortcuts>
3.添加几种需要用到而之前没有的权限:
b/packages/apps/Launcher3/AndroidManifest.xml
<original-package android:name="com.android.launcher3" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
+ <uses-permission
android:name="android.permission.ADVANCED_WIDGET_API"/>
+ <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
+ <uses-permission android:name="android.permission.INSTALL_PACKAGES"/>
+ <uses-permission android:name="android.permission.DELETE_PACKAGES"/>
4.定义要用的字符串:b/packages/apps/Launcher3/res/values/attrs.xml
+ <!-- XML attributes used by unread_support_shortcuts.xml -->
+ <declare-styleable name="UnreadShortcut">
+ <attr name="unreadPackageName" format="string" />
+ <attr name="unreadClassName" format="string" />
+ <attr name="unreadKey" format="string" />
+ <attr name="unreadType" format="integer" />
+ </declare-styleable>
5.定义显示的数字大小尺寸,这个可以自己修改到满意,这个是四行五列排列的
1080*1920屏幕大小的尺寸。
b/packages/apps/Launcher3/res/values/dimens.xml
+ <!-- Add for unread events feature. -->
+ <dimen name="unread_minWidth">20dp</dimen>
+ <dimen name="hotseat_unread_margin_top">16dp</dimen>
+ <dimen name="hotseat_unread_margin_right">8dp</dimen>
+ <dimen name="folder_unread_margin_top">16dp</dimen>
+ <dimen name="folder_unread_margin_right">14dp</dimen>
+ <dimen name="workspace_unread_margin_top">16dp</dimen>
+ <dimen name="workspace_unread_margin_right">16dp</dimen>
+ <dimen name="app_list_unread_margin_top">20dp</dimen>
+ <dimen name="app_list_unread_margin_right">16dp</dimen>
+ <dimen name="unread_text_margin">8dp</dimen>
+ <dimen name="unread_text_number_size">14sp</dimen>
+ <dimen name="unread_text_plus_size">10sp</dimen>
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询