Skip to content

Instantly share code, notes, and snippets.

@senneco
Created June 2, 2017 08:04
Show Gist options
  • Save senneco/b254ca8fda2f71f37bfbb848470d94b3 to your computer and use it in GitHub Desktop.
Save senneco/b254ca8fda2f71f37bfbb848470d94b3 to your computer and use it in GitHub Desktop.
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment