title: Android WindowManager.LayoutParams y offset
body: <p>I want to draw something on full screen programmatically from top of the screen. However, there is always a y axis offset. It seems the height of status (title) bar.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.activity_main);
      WindowManager.LayoutParams params = new WindowManager.LayoutParams(
              WindowManager.LayoutParams.WRAP_CONTENT,
              WindowManager.LayoutParams.WRAP_CONTENT,
              WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
              WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                      | WindowManager.LayoutParams.FLAG_FULLSCREEN,
              PixelFormat.TRANSLUCENT);
      params.gravity = Gravity.LEFT | Gravity.TOP;
      params.x = 0;
      params.y = 0;
      params.width = 200;
      params.height = 300;
  
      GradientDrawable gd = new GradientDrawable();
      gd.setShape(GradientDrawable.RECTANGLE);
      gd.setColor(Settings.highlightColor);
      ImageView iv = new ImageView(this);
      iv.setImageDrawable(gd);
      WindowManager windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
      windowManager.addView(iv, params);
  </code></pre>
  
  <p>I already set full screen in AndroidManifest.xml:</p>
  
  <pre><code>android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
  </code></pre>
  
  <p>Here is what I got:</p>
  
  <p><a href="https://i.stack.imgur.com/E60Qk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E60Qk.png" alt="Result"></a></p>