拉下Status bar之后,可以点击上面对应的icon,从而调出相应的Activity。
请问这个过程是怎么实现的?或者说,具体是哪个类的按键事件做出的反应
请问这个过程是怎么实现的?或者说,具体是哪个类的按键事件做出的反应
解决方案 »
- String的判断问题
- 在ExpandableListView中子item中有两个按钮,要如何监听呢?
- android 中addProximityAlert()大家谁用过呢?我想多加几个监听点怎么实现?
- 关于Android开机动画
- Tap键功能怎么实现
- 关于安装Android遇到的问题?
- 自定义像素创建的AVD模拟器,没有显示键盘。。。
- 求助,Android开发中一页面效果
- android 百度地图 gps定位
- 求解:android studio中,android 8.0后如何打开wifi热点及更改热点帐号密码?
- EditText 设置 windows 输入IP 效果
- 运行时报分号错误,不懂。。。求解释!!!
PendingIntent contentIntent = PendingIntent.getActivity(this,0,notificationIntent,0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
nf.notify(0, notification);
那么,点击statusbar对应的图标时,具体的按键响应过程是怎么样的呢?
StatusBarView.java
StatusBarService.java
onTouchEvent和onInterceptTouchEvent
这两个方法主要是用来响应statusbar的下拉事件,使之能显示扩展的状态栏。
StatusBarService.java有个内部类,Launcher,该类中有个方法onClick: public void onClick(View v) {
try {
// The intent we are sending is for the application, which
// won't have permission to immediately start an activity after
// the user switches to home. We know it is safe to do at this
// point, so make sure new activity switches are now allowed.
ActivityManagerNative.getDefault().resumeAppSwitches();
} catch (RemoteException e) {
}
if (mIntent != null) {
int[] pos = new int[2];
v.getLocationOnScreen(pos);
Intent overlay = new Intent();
overlay.setSourceBounds(
new Rect(pos[0], pos[1], pos[0]+v.getWidth(), pos[1]+v.getHeight()));
try {
mIntent.send(StatusBarService.this, 0, overlay);
} catch (PendingIntent.CanceledException e) {
// the stack trace isn't very helpful here. Just log the exception message.
Slog.w(TAG, "Sending contentIntent failed: " + e);
}
}
try {
mBarService.onNotificationClick(mPkg, mTag, mId);
} catch (RemoteException ex) {
// system process is dead if we're here.
}
// close the shade if it was open
animateCollapse();
}
}感觉mBarService.onNotificationClick(mPkg, mTag, mId);这个方法应该就是处理按键消息的。只不过没用到上层传过来的contentIntent参数。搞不懂了
我想问我下拉了通知栏点击后成功连到了另一个class但是此时上面的那个通知栏还是显示着自己的提示。请问我想做到拉下来后点击连接到另个class后上面的提示也消失怎么做?
我想问我下拉了通知栏点击后成功连到了另一个class但是此时上面的那个通知栏还是显示着自己的提示。请问我想做到拉下来后点击连接到另个class后上面的提示也消失怎么做?将发出来的notification的flags设置为FLAG_AUTO_CANCEL就可以啦