Android 图标电池
通过我的程序,我启动了一项活动,显示电池电量不足的假警报对话框。现在我还想更改状态栏上的图标电池,但这是一个系统图标,没有 api 可以执行此操作。我在互联网上发现这个非公共API http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.5_r4/com/android/server/ status/StatusBarIcon.java 但我对这一行有一个问题:
1) View v = inflater.inflate(com.android.internal.R.layout.status_bar_icon,parent, false);
2) AnimatedImageView im = (AnimatedImageView)v.findViewById(com.android.internal.R.id.image);
因为在官方 API 上没有 com.android.internal.R.layout .status_bar_icon 或 com.android.internal.R.id.image 我尝试用 costant int 值替换,但对于第一行,我得到 View v = com.android.server.status.statusbarview@44f0a2c0 但对于第二行,我得到 AnimatedImageView im = null :-(
我该怎么做?
我做不到,我想在全屏 modo 和 notitle 中创建一个透明活动,并将我的假电池图像放在顶部,并留有布局边距,将其放在电池图标上。我尝试过,但我的图像位于状态栏下方...为什么? :-(
With my program I launch a activity that show a fake alertdialog for battery low. Now I want change also the icon battery on status bar but this is a system icon and there is not api for to do this. I found on the Internet this not public API http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.5_r4/com/android/server/status/StatusBarIcon.java but I have a problem for this line :
1) View v = inflater.inflate(com.android.internal.R.layout.status_bar_icon, parent, false);
2) AnimatedImageView im = (AnimatedImageView)v.findViewById(com.android.internal.R.id.image);
because on official API there is not a com.android.internal.R.layout.status_bar_icon or com.android.internal.R.id.image I tried to replace with costant int value but for first line I get View v = com.android.server.status.statusbarview@44f0a2c0 but for second line I get AnimatedImageView im = null :-(
How can I do it?
I can not do it, I thought of creating a transparent activity in fullscreen modo and notitle and put my fake battery image on the top and with layout margin left put it over the battery icon. I tried it but my image go under the status bar...why ?? :-(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Mimmo,
据我所知,更改状态栏中电池图标的唯一方法是自定义 ROM。我不相信它可以通过编程来完成,即使具有 root 访问权限。
Mimmo,
As far as I know, the only way to change the battery icon in the status bar would be a custom ROM. I don't believe it can be done programmatically, even with root access.