android: how to align image in the horizontal center of an imageview?

Posted by Yang on Stack Overflow See other posts from Stack Overflow or by Yang
Published on 2010-04-06T18:27:14Z Indexed on 2010/04/06 18:33 UTC
Read the original article Hit count: 943

Filed under:
|

I've tried all scaletype in gravity, but all of them result in the image to be at the left corner of the imageview.

 <ImageView
    android:id="@+id/image"
    android:scaleType="centerInside"

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    android:layout_marginRight="6dip"
    android:background="#0000" 
    android:src="@drawable/icon1" />

© Stack Overflow or respective owner

Related posts about android

Related posts about alignment