How to center an ImageView in a LinearLayout?

You have to set vertical orientation on your LinearLayout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
    android:id="@+id/myimg" 
    android:layout_width="36dip"
    android:layout_height="36dip"
    android:scaleType="fitXY"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/my_background"
/>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)