|
发表于 2014-9-6 13:50:42
|
显示全部楼层
4.4要a80的才有,如下是添加屏幕截图功能的代码,可参考下- policy/src/com/android/internal/policy/impl/PhoneWindowManager.java下
- public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn) {函数添加
- case 388:{
- if (down) {
- new Thread(new Runnable() {
- @Override
- public void run() {
- takeScreenshot();
- }
- }).start();
- }
- break;
- }
- 增加图片资源 print_screen.png
- X:\4.1-V10-A13-zhu\android4.1\frameworks\base\packages\SystemUI\res\drawable-mdpi\print_screen.png
- X:\4.1-V10-A13-zhu\android4.1\frameworks\base\packages\SystemUI\res\layout\system_bar.xml添加button按钮
- <!--zhu start 2012.12.11-->
- <com.android.systemui.statusbar.policy.KeyButtonView
- android:id="@+id/print_screen"
- android:layout_width="81dip"
- android:layout_height="match_parent"
- android:src="@drawable/print_screen"
- systemui:keyCode="388"
- systemui:glowBackground="@drawable/ic_sysbar_highlight"
- android:visibility="gone"
- />
- <!--zhu end 12.12.11-->
- X:\4.1-V10-A13-zhu\android4.1\frameworks\base\packages\SystemUI\src\com\android\systemui\statusbar\tablet\TabletStatusBar.java
- View mPrintScreenButton;//zhu
- mStatusBarView.setIgnoreChildren(2, mInputMethodSwitchButton, mInputMethodsPanel);下面一行添加
- mStatusBarView.setIgnoreChildren(4, mPrintScreenButton, mRecentsPanel);//zhu
- mPrintScreenButton = mNavigationArea.findViewById(R.id.print_screen);//zhu 2012.12.11
- mPrintScreenButton.setVisibility(View.VISIBLE);//zhu 2012.12.11
复制代码
|
|