我正在使用以下代码将文本视图添加到Window
public static void addViewToWindow(Activity activity, View view, WindowManager.LayoutParams params)
{
WindowManager windowManager = (WindowManager)activity.getSystemService(Context.WINDOW_SERVICE);
windowManager.addView(view, params);
}
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_APPLICATION_PANEL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.OPAQUE);
params.gravity = Gravity.BOTTOM;
params.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
addViewToWindow(myActivity, myEditText, params);
但是我无法长按EditText来让用户复制/粘贴。只要我将设备的方向更改为横向,EditText就会覆盖整个屏幕,我可以通过长按来复制/粘贴。我无法弄清楚我做错了什么。