title: How to align an ImageButton in Android FrameLayout programmatically
body: <p>My app's layout is FrameLayout.  I want to align an ImageButton to right top of the framelayout.  I tried below code not worked.</p>
  
  <pre><code>    mImageButton = new ImageButton(mContext);
      LayoutParams ll = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT );
      ll.gravity = Gravity.RIGHT;
      mImageButton.setLayoutParams(ll);
      mImageButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_menu_moreoverflow_normal_holo_light));
      this.addView(mImageButton);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/c7FaC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c7FaC.png" alt="expected output"></a>expected output</p>