[英]Android System Overlay 4.2.2
// fetch window manager object
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
// set layout parameter of window manager
WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(
30, // width of layout 30 px
200, // height is equal to full screen
WindowManager.LayoutParams.TYPE_PHONE, // Type Ohone, These are non-application windows providing user interaction with the phone (in particular incoming calls).
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
// WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH // this window won't ever get key input focus
PixelFormat.TRANSLUCENT
);
mParams.gravity = Gravity.LEFT | Gravity.TOP;
//mParams.setTitle("Load Average");
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
mWindowManager.addView(touchLayout, mParams);
touchLayout.setOnTouchListener(this);
这只是代码片段。 我的第一个问题是在视图中将要执行的操作,但是,在运行此服务时,在其他应用程序中触摸编辑文本框时,软键盘无法打开。 我尝试了各种解决问题的标志,但是我失去了将触摸事件注册到屏幕部分的能力,如代码中上面显示的那样。
我没有主意,是否有人对我要去的地方有任何想法,还是对Android 4.2.2+的替代解决方案有任何想法?
尝试这个:
Dialog dialog = new Dialog(this,android.R.style.Theme_DeviceDefault_Dialog_NoActionBar_MinWidth);
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
dialog.setContentView(new EditText(this));
dialog.show();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.