How to make a movable popup over the call screen?



So far I've been using a Dialog over the call screen using the following :



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/**getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
getWindow().addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);**/

wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
params1 = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT |
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSPARENT);

params1.height = 75;
params1.width = 512;
params1.x = 265;
params1.y = 400;
params1.format = PixelFormat.TRANSLUCENT;
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View myView = inflater.inflate(R.layout.dialog, null);
wm.addView(myView, params1);


}
}


What I want to do is create a popup window like this :


enter image description here


No comments:

Post a Comment