title: Android image view gravity
body: <p>How can I dynamically set the gravity ? </p>
  
  <pre><code>Bitmap bmp;
  im = new ImageView (this);
  bmp=getbmp(img);
  im.setImageBitmap(bmp);  
  </code></pre>
  
  <p>Now I would like to put the image in the top . Ho can I do this without <code>android:gravity</code> in main.xml ?</p>
  
  <p>EDIT : </p>
  
  <p>main.xml </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent" android:layout_height="fill_parent"
      android:scrollbars="vertical"
  
      &gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>I have a frame layout and I add to it the image , and then the text and I would like the image to be on the top of the screen.</p>
  
  <pre><code>FrameLayout fm = new FrameLayout (this);
  fm.addView(im);
  fm.addView(fin); // fin = the text view
  setContentView(fm);
  </code></pre>