android:gravity="top|center_vertical"

解决方案 »

  1.   

    现在的效果是靠上边沿的水平中心对齐,我想要在item中心啊
      

  2.   

    加个Gravtity,设置水平居中,垂直居中 
      

  3.   


    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="200dp"
        android:layout_height="200dp"
     android:gravity="center"
     >
    不好用
      

  4.   

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="200dp"
        android:layout_height="200dp" >
    <RelativeLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravtiy="center" >
        <ImageView
            android:id="@+id/iv_pic"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_centerInParent="true"
            android:src="@drawable/detail" >
        </ImageView></RelativeLayout>
    </RelativeLayout>