title: Programmatically set layout_gravity for a FrameLayout's Child?
body: <p>This seems like it should be trivial, but I can't figure out how to set the layout_gravity for a FrameLayout's child programmatically for the life of me.</p>
  
  <p>There's a ton of similar questions on SO, but after trying a good 10 of them, none of the setGravity, new FrameLayout.LayoutParams, etc. solutions seem to work.</p>
  
  <p>Below is a simplified version of what I'm trying to achieve.</p>
  
  <pre><code>&lt;FrameLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;TextureView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="bottom"/&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>However, for external reasons, I'm adding the TextureView to the FrameLayout programatically. </p>
  
  <pre><code>mCameraPreview = new CameraPreview(this, recordMode);
  FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview_wrapper);
  preview.addView(mCameraPreview);
  </code></pre>
  
  <p>When I try to set the layout_gravity on the mCameraPreview, it only gives me an option for gravity, which I don't want.</p>
  
  <p>Is there something I'm missing here?</p>