title: adding dynamic view using WindowManager.addView
body: <p>I have a code on ICS for tablets. I want to add a Imageview dynamicly to a fragment. The fragment already contains preferencelist.  The code for adding the view dynamically is as follows. I am coding this drag and drop functionality. This part of the code is taken from TouchInterceptor.java file from android music app.</p>
  
  <pre><code>mWindowParams = new WindowManager.LayoutParams();
  mWindowParams.gravity = Gravity.TOP ;
  mWindowParams.x = 0;
  mWindowParams.y = y
  mWindowParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
  mWindowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
      | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
      | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
      | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
  mWindowParams.format = PixelFormat.TRANSLUCENT;
  mWindowParams.windowAnimations = 0;
  
  ImageView v = new ImageView(mContext);
  int backGroundColor = mContext.getResources().getColor(R.color.bg_background);
  v.setBackgroundColor(backGroundColor);
  v.setImageBitmap(bm);
  
  mWindowManager = (WindowManager)mContext.getSystemService("window");
  mWindowManager.addView(v, mWindowParams);
  </code></pre>
  
  <p>I am specifying the x coordinate of windowlayout param as 0. Eventthen when the view is displayed , itstead of displaying from the leftside of the fragment(the right pane) ,the view is displayed from middle of the right pane and is spanning to  the right pane . What I am doing wrong ? Whats has to be done to correct this ?</p>