在通话过程中最小化Skype应用后,Skype如何管理主屏幕上显示的视频通话拖动功能。您可以从主屏幕选择并启动其他应用程序,Skype弹出窗口仍然在屏幕上,甚至与其他应用程序并行。如果是App小部件,那么如何在主屏幕上和其他应用程序UI中添加或删除。
答案 0 :(得分:0)
使用WindowManager添加Float视图:
private void createFloatView()
{
Button btn_floatView = new Button();
btn_floatView = new Button(getApplicationContext());
btn_floatView.setText("FloatView");
wm = (WindowManager) getApplicationContext().getSystemService(
Context.WINDOW_SERVICE);
params = new WindowManager.LayoutParams();
params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
params.format = PixelFormat.RGBA_8888;
params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
params.width = 100;
params.height = 100;
btn_floatView.setOnTouchListener(new OnTouchListener()
{
int lastX, lastY;
int paramX, paramY;
public boolean onTouch(View v, MotionEvent event)
{
switch (event.getAction())
{
case MotionEvent.ACTION_DOWN:
lastX = (int) event.getRawX();
lastY = (int) event.getRawY();
paramX = params.x;
paramY = params.y;
break;
case MotionEvent.ACTION_MOVE:
int dx = (int) event.getRawX() - lastX;
int dy = (int) event.getRawY() - lastY;
params.x = paramX + dx;
params.y = paramY + dy;
wm.updateViewLayout(btn_floatView, params);
break;
}
return true;
}
});
wm.addView(btn_floatView, params);
isAdded = true;
}