title: how to center layout to vertical in android through java code?
body: <p>friends,</p>
  
  <p>i want to set android:layout_centerVertical="true" property of layout
  through java code of an image.</p>
  
  <p>can any one guide me how to achieve this. here is my code.</p>
  
  <pre><code>RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
  
  params.height = (int)totalHeight;
  
  img.setLayoutParams(params);
  </code></pre>
  
  <p>i have tried using setScaleType(ScaleType.FIT_CENTER) but no use.</p>
  
  <p>any help would be appriciated. </p>