title: Add ImageView to RelativeLayout in Android
body: <p>So I have created an <code>ImageView</code> programmatically in my <code>Activity</code>.<br>
  I want to add this <code>ImageView</code> at the bottom of one of my <code>RelativeLayout</code>.</p>
  
  <p>This is what I tried:</p>
  
  <pre><code>// creating new ImageView
  ImageView shadowView = new ImageView (contextPara);
  shadowView.SetBackgroundResource (Resource.Drawable.bottomBar_Shadow);
  shadowView.SetScaleType (ImageView.ScaleType.FitXy);
  
  // creating ImageView LayoutParams
  WindowManagerLayoutParams imgViewLayoutParams = new WindowManagerLayoutParams ();
  imgViewLayoutParams.Width = ViewGroup.LayoutParams.MatchParent;
  imgViewLayoutParams.Height = (int)imgViewHeight;
  imgViewLayoutParams.Gravity = GravityFlags.Bottom;
  
  // Adding ImageView to RelativeLayout
  listViewRelativeLayout.AddView (shadowView, imgViewLayoutParams);
  </code></pre>
  
  <p>My problem is this adds the <code>ImageView</code> to the TOP of the <code>RelativeLayout</code>, NOT the bottom.</p>
  
  <p>I also tried the following:<br>
  After I call the <code>AddView</code> and add the <code>ImageView</code>, I set the <code>Y</code> position of the <code>ImageView</code>.<br>
  This actually works.  It moves the <code>ImageView</code> down but I'm not sure how much to move down.  <code>RelativeLayout</code> size is not absolute.  </p>
  
  <pre><code>// this moves the ImageView down 100px.
  shadowView.SetY (100f);
  </code></pre>
  
  <p>How can I put it to the bottom of the <code>RelativeLayout</code>?  </p>
  
  <p>Please note: I CAN'T just do the math (<code>RelativeLayout</code> height - <code>ImageView</code> Height) because <code>RelativeLayout</code> height is always <code>0</code> until <code>OnCreate</code> finishes.</p>
  
  <p>What are my other choices?</p>
  
  <p>Thank you for your time.</p>