title: Change TextureView Size at Runtime
body: <p>I am working on streaming a mp4 to a textureView for a app i am currently working on. i have the TextureView displaying the video however i need to resize it to match the screen size on rotation. After much trial and error it seems that the problem is that the TextureView cannot be made larger than the containing view. I have also tried to resize the container view but i am then unable to center the TextureView correctly on screen.</p>
  
  <pre><code> public void onOrientationChanged(int orientation) {
                  if(isLandscape(orientation)){
                      myTexture.setRotation(-90);
                      RelativeLayout.LayoutParams params = new           RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
  params.width = height;
                      params.height = (height * 9)/16;
                      params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
  
  
                      myTexture.setLayoutParams(params);
                      myTexture.getLayoutParams().height = (height * 9)/16;
                      myTexture.getLayoutParams().width = height;
  
                      rl.requestLayout();
                      rl.invalidate();
                      rl.recomputeViewAttributes(myTexture);
  
                      Log.v("View Size", "Width tex: " + myTexture.getWidth());
                      Log.v("View Size", "Height tex: " + myTexture.getHeight());
                      Log.v("View Size", "Width tex parent: " + rl.getWidth());
                      Log.v("View Size", "Height tex parent : " + rl.getHeight());
  
                  }
  
  
      &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MyActivity"
      android:id="@+id/mediaParent"
      android:layout_centerInParent="true"
      android:paddingLeft="0dp"
      android:paddingRight="0dp"
      android:paddingTop="0dp"
      android:paddingBottom="0dp"&gt;
  
          &lt;TextureView
              android:layout_width="360dp"
              android:layout_height="203dp"
              android:id="@+id/surface"
              android:layout_alignParentTop="true"
              android:layout_centerHorizontal="true" /&gt;
  
      &lt;Button
          style="?android:attr/buttonStyleSmall"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="New Button"
          android:id="@+id/button"
          android:layout_alignParentBottom="true"
          android:layout_centerHorizontal="true" /&gt;
  
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>