Пример #1
0
 /*
  * For some reason, it's very difficult to create a layout that covers exactly the entire screen
  * and doesn't move when an unhandled key is pressed. The configuration we're using seems to
  * result in a layout that starts above the screen. So we split initialization into two
  * pieces, and here we find out where the overlay ended up and move it to be at the top
  * of the screen.
  * TODO(pweaver) Separating the menu and highlighting should be a cleaner way to solve this
  * issue
  */
 private void configureOverlayAfterShow() {
   int[] location = new int[2];
   mRelativeLayout.getLocationOnScreen(location);
   WindowManager.LayoutParams layoutParams = mOverlay.getParams();
   layoutParams.y -= location[1];
   mOverlay.setParams(layoutParams);
 }
Пример #2
0
  private void configureOverlayBeforeShow() {
    // The overlay shouldn't capture touch events
    final WindowManager.LayoutParams params = mOverlay.getParams();
    params.type = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
    params.flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
    params.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;

    /* The overlay covers the entire screen. However, there is a left, top, right, and
     * bottom margin.  */
    final WindowManager wm =
        (WindowManager) mOverlay.getContext().getSystemService(Context.WINDOW_SERVICE);
    final Point size = new Point();
    wm.getDefaultDisplay().getRealSize(size);
    params.height = size.y;
    params.width = size.x;
    params.x = 0;
    params.y = 0;

    mOverlay.setParams(params);
  }