WEB开发网
开发学院手机开发Android 开发 在android的状态栏(statusbar)中增加menu,home和... 阅读

在android的状态栏(statusbar)中增加menu,home和back快捷键的方法

 2010-09-15 00:01:00 来源:WEB开发网   
核心提示:1="+(System.currentTimeMillis()/*-n*/));IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));Log.d("Tige
1="+(System.currentTimeMillis()/*-n*/));

IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));

Log.d("Tiger", "Intent.ACTION_SOFT_"+keyCode+"_PRESSED 2="+(System.currentTimeMillis()/*-n*/));

wm.injectKeyEvent(down, false);

Log.d("Tiger", "Intent.ACTION_SOFT_"+keyCode+"_PRESSED 3="+(System.currentTimeMillis()/*-n*/));

wm.injectKeyEvent(up, false);

Log.d("Tiger", "Intent.ACTION_SOFT_"+keyCode+"_PRESSED 4="+(System.currentTimeMillis()/*-n*/));

} catch (RemoteException e) {

Log.i("Input", "DeadOjbectException");

}

}

};

/* End : ADDED by TigerPan 20100831 */

5.避免在按下这几个按钮时,触发下拉Notification视图,影响性能

修改onInterceptTouchEvent(MotionEvent event)函数

@Override

public boolean onInterceptTouchEvent(MotionEvent event) {

/* Begin : Modified by TigerPan */

if (keysLayout.getRight() < event.getX())

return mService.interceptTouchEvent(event) ? true : super.onInterceptTouchEvent(event);

/*int parentLeft = mStatusIcons.getLeft();

android.util.Log.i("Tiger","....."+(event.getX() < (parentLeft + iconVolDown.getLeft()) || event.getX() > (parentLeft + iconHome.getRight())));

if(event.getX() < (parentLeft + iconVolDown.getLeft()) || event.getX() > (parentLeft + iconHome.getRight()))

return mService.interceptTouchEvent(event) ? true : super.onInterceptTouchEvent(event);

*/

return false;

/* End : Modified by TigerPan */

}

这样,基本上就完成了。

编译一下

~/donut$ source ./env.sh

~/donut$ make update-api

~/donut$ make ?j8

~/donut$ emulator ?skin WVGA800

~/donut$ source ./env.sh

~/donut$ make update-api

~/donut$ make ?j8

~/donut$ emulator ?skin WVGA800

上一页  1 2 3 4 5 6 

Tags:android 状态 statusbar

编辑录入:coldstar [复制链接] [打 印]
赞助商链接