Skip to content

Instantly share code, notes, and snippets.

@senneco
Created June 2, 2017 08:04
Show Gist options
  • Select an option

  • Save senneco/b254ca8fda2f71f37bfbb848470d94b3 to your computer and use it in GitHub Desktop.

Select an option

Save senneco/b254ca8fda2f71f37bfbb848470d94b3 to your computer and use it in GitHub Desktop.

Revisions

  1. senneco created this gist Jun 2, 2017.
    21 changes: 21 additions & 0 deletions Temp.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    public class Temp {
    public View showFloatingView(View contentView)
    {
    final View floatingView = ((LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE)).inflate(R.layout.view_floating, null);

    final WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);

    final WindowManager.LayoutParams mLayoutParams = new WindowManager.LayoutParams(
    WindowManager.LayoutParams.WRAP_CONTENT,
    WindowManager.LayoutParams.WRAP_CONTENT,
    WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
    WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
    | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
    | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
    | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
    | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
    PixelFormat.TRANSLUCENT);

    windowManager.addView(floatingView, mLayoutParams);
    }
    }