title: Positioning an image inside an ImageView with gravity: top
body: <pre><code>      ╔════════════════════════════════════════════════════════╗
        ║               Linear Layout  (Center)                  ║
        ║    ╔══════════════════════════════════════════════╗    ║   
        ║    ║ ImageView    ╔══════════════╗                ║    ║
        ║    ║              ║              ║    (Center)    ║    ║
        ║    ║              ║ Actual image ║                ║    ║
        ║    ║              ║              ║                ║    ║
        ║    ║              ║  (Center)    ║                ║    ║
        ║    ║              ║              ║                ║    ║
        ║    ║              ╚══════════════╝                ║    ║
        ║    ╚══════════════════════════════════════════════╝    ║ 
        ║                                                        ║
        ╚════════════════════════════════════════════════════════╝
  </code></pre>
  
  <p>And I want to do this:</p>
  
  <pre><code>      ╔════════════════════════════════════════════════════════╗
        ║               Linear Layout  (Center)                  ║
        ║    ╔══════════════════════════════════════════════╗    ║   
        ║    ║ ImageView    ║              ║                ║    ║
        ║    ║              ║              ║    (Center)    ║    ║
        ║    ║              ║ Actual image ║                ║    ║
        ║    ║              ║              ║                ║    ║
        ║    ║              ║  (Top)       ║                ║    ║
        ║    ║              ║              ║                ║    ║
        ║    ║              ╚══════════════╝                ║    ║
        ║    ╚══════════════════════════════════════════════╝    ║ 
        ║                                                        ║
        ╚════════════════════════════════════════════════════════╝
  </code></pre>
  
  <p>Note that : imageview has gravity center with Linear Layout
  I want the image in the imageview has gravity top, i try to set gravity:top, but nothing change. Help me</p>
  
  <p>Edit: this is my xml </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="fill_parent"
      android:layout_height="fill_parent" android:background="@color/all_white"&gt;
      &lt;LinearLayout android:id="@+id/title_bar" style="@style/TitleBar"&gt;
          &lt;TextView android:layout_width="wrap_content" 
              android:id="@+id/tv_printweb"
              android:singleLine="true" 
              android:ellipsize="end" 
              style="@style/ScreenTitleText" /&gt;
      &lt;/LinearLayout&gt;
      &lt;RelativeLayout android:orientation="vertical"
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent"
          android:layout_below="@+id/tv_web_filename" 
          android:layout_above="@+id/tv_web_page_num"
          android:layout_weight="1" 
          android:background="@color/background"&gt;
          &lt;LinearLayout android:id="@+id/ln_web_pre"
              android:layout_width="30dp" 
              android:layout_height="fill_parent"
              android:layout_alignParentLeft="true" 
              android:gravity="center"&gt;
              &lt;Button android:id="@+id/btn_web_pre" 
                  android:layout_width="40dp"
                  android:layout_height="120dp" 
                  android:background="@drawable/bt_left"
                  /&gt;
          &lt;/LinearLayout&gt;
          &lt;LinearLayout android:id="@+id/ln_web_zoomview"
              android:layout_width="fill_parent" 
              android:layout_height="fill_parent"
              android:background="@color/all_white" 
              android:orientation="vertical"
              android:gravity="center" 
              android:layout_centerInParent="true"&gt;
              &lt;ImageView android:id="@+id/web_zoomview"
                  android:layout_width="fill_parent" 
                  android:layout_height="wrap_content"
                  android:background="@color/all_white" 
                  android:layout_gravity="top"
                  /&gt;
  
          &lt;/LinearLayout&gt;
          &lt;LinearLayout android:id="@+id/llCircle"
                  android:layout_height="fill_parent" 
                  android:layout_width="fill_parent"
                  android:layout_marginRight="40dp" 
                  android:layout_marginLeft="40dp" 
                  android:layout_marginBottom="25dp" 
                  android:layout_marginTop="25dp"&gt;
          &lt;/LinearLayout&gt;
          &lt;LinearLayout android:id="@+id/ln_web_next"
              android:layout_width="30dp" 
              android:layout_height="fill_parent"
              android:layout_alignParentRight="true" 
              android:gravity="center"&gt;
              &lt;Button android:id="@+id/btn_web_next" 
                  android:layout_width="40dp"
                  android:layout_height="120dp" 
                  android:background="@drawable/bt_right_1"
                  /&gt;
          &lt;/LinearLayout&gt;
          &lt;RelativeLayout android:id="@+id/pagebar_web_top"
              android:layout_width="fill_parent" 
              android:layout_height="30dp"
              android:layout_alignParentTop="true" 
              android:gravity="center_vertical"
              android:paddingLeft="10dip" 
              android:paddingRight="10dip"&gt;
              &lt;TextView android:id="@+id/tv_web_page_size"
                  android:layout_width="wrap_content" 
                  android:layout_height="wrap_content"
                  android:layout_alignParentRight="true" 
                  android:gravity="center"
                  android:text="Paper Size" 
                  android:textColor="@color/all_black"
                  android:textStyle="bold" 
                  android:background="@drawable/paper_border" /&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;RelativeLayout android:id="@+id/web_pagebar"
              android:layout_width="fill_parent" 
              android:layout_height="50dp"
              android:layout_alignParentBottom="true" 
              android:gravity="left"
              android:paddingLeft="10dip" 
              android:paddingRight="10dip"&gt;
              &lt;TextView android:id="@+id/tv_page_num"
                  android:layout_width="wrap_content" 
                  android:layout_height="wrap_content"
                  android:layout_centerVertical="true" 
                  android:gravity="center"
                  android:text="1/1" 
                  android:textColor="@color/all_black"
                  android:textStyle="bold" 
                  android:background="@drawable/paper_border" /&gt;
              &lt;Button android:id="@+id/btn_web_orientation"
                  android:layout_width="50dp" 
                  android:layout_height="50dp"
                  android:layout_alignParentRight="true" 
                  android:background="@drawable/rotate_l" /&gt;
          &lt;/RelativeLayout&gt;
  
      &lt;/RelativeLayout&gt;
      &lt;LinearLayout android:gravity="right|center_horizontal"
          android:id="@+id/toolbar" 
          style="@style/FunctionBar"&gt;
          &lt;Button android:layout_width="wrap_content"
              android:layout_height="wrap_content" 
              android:id="@+id/btn_web_print"
              style="@style/FunctionButton" 
              android:text="@string/str_print" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>