在状态栏上的Android应用程序图标 [英] android app icon in status bar
问题描述
我能够使我的应用程序的通知栏的条目,但我想打一个图标我在状态栏,其中电池,无线网络,蓝牙,时间图标显示应用程序。
我已搜查这一点,但得到这个much-不能只从应用程序的控制,同时建设的Android,在Android中源 - code的框架目录中的某些-,我们不得不把一些行得到它完成后,
我没有任何线索,它是如何管理的。
I am able to make an entry in the notification bar for my app, but I want to make an icon for my app in the status bar, where battery, wi-fi, bluetooth,time icons are shown. I have searched about this, but got this much- it can't be controlled from the app only, while building android ,some-where in the frameworks directory of android source-code we have to put some lines to get it done, I don't have any clue how is it managed.
推荐答案
对不起,我没有足够的信誉来添加为评论,但你看着像这些类似的问题?您可以在通知中添加绘制资源为你想要的图标,并设置标志,这样应该让图标仍然在状态栏中。 FLAG_NO_CLEAR
和 FLAG_ONGOING_EVENT
可以让你做出一个图标显示在状态栏上的answerd这些问题描述。
Sorry I don't have enough reputation to add this as a comment, but have you looked at similar questions like these?. You can add a drawable resource for the icon you want and set flags on your notification so that should allow the icon to remain in the status bar. FLAG_NO_CLEAR
and FLAG_ONGOING_EVENT
can allow you to make an icon appear in the status bar as the answerd to these questions describes.
<一个href=\"http://stackoverflow.com/questions/3973208/icon-in-the-status-bar-when-application-is-running\">Icon在状态栏时,应用程序运行
<一个href=\"http://stackoverflow.com/questions/3712758/controlling-the-android-status-bar-icon?rq=1\">controlling Android的状态栏图标
如果您有AOSP的完整结帐我会建议您检查出StatusBarManager服务即可。显示notificatons时通知回调使用此项服务的内部。还有一种粘合剂界面,允许设置的图标。
If you have a full checkout of AOSP I would recommend checking out the StatusBarManager service then. The notification uses callbacks inside of this service when showing notificatons. There is also a binder interface that allows setting icons.
在/frameworks/base/services/java/com/android/server/StatusBarManagerService.java和
/frameworks/base/core/java/com/android/internal/statusbar/IStatusBarService.aidl的setIcon无效(字符串槽,字符串iconPackage,诠释iconId,诠释iconLevel,字符串contentDescription);
in /frameworks/base/services/java/com/android/server/StatusBarManagerService.java and
/frameworks/base/core/java/com/android/internal/statusbar/IStatusBarService.aidl
void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
无效setIconVisibility(字符串槽,布尔可见);
在/frameworks/base/core/res/res/values/config.xml
in /frameworks/base/core/res/res/values/config.xml
<item><xliff:g id="id">ime</xliff:g></item>
<item><xliff:g id="id">sync_failing</xliff:g></item>
<item><xliff:g id="id">sync_active</xliff:g></item>
<item><xliff:g id="id">gps</xliff:g></item>
<item><xliff:g id="id">bluetooth</xliff:g></item>
<item><xliff:g id="id">nfc</xliff:g></item>
<item><xliff:g id="id">tty</xliff:g></item>
<item><xliff:g id="id">speakerphone</xliff:g></item>
<item><xliff:g id="id">mute</xliff:g></item>
<item><xliff:g id="id">volume</xliff:g></item>
<item><xliff:g id="id">wifi</xliff:g></item>
<item><xliff:g id="id">cdma_eri</xliff:g></item>
<item><xliff:g id="id">data_connection</xliff:g></item>
<item><xliff:g id="id">phone_evdo_signal</xliff:g></item>
<item><xliff:g id="id">phone_signal</xliff:g></item>
<item><xliff:g id="id">battery</xliff:g></item>
<item><xliff:g id="id">alarm_clock</xliff:g></item>
<item><xliff:g id="id">secure</xliff:g></item>
<item><xliff:g id="id">clock</xliff:g></item>
的是得到默认添加到状态栏的插槽值
the are the values for slots that get added by default to the statusbar
希望这有助于
这篇关于在状态栏上的Android应用程序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!