2012-02-24 44 views
0

我有画廊小部件,显示50dp高的布局。当用户点击一个画廊项目时,该布局将增长到100dp高。我已经有了这种扩展行为,可以正常工作。但是,问题在于画廊正在将项目呈现为水平和垂直居中。如何使图库项目顶部对齐?

我想要的是让它居中水平和顶部对齐。所以当用户点击一个项目时,它看起来开放的“滚动”。

回答

1
<Gallery xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/gallery" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:gravity="top" 
/> 
0

尝试在您的项目布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 

    <ImageView 

      .......... 
      android:layout_centerHorizontal="true" 
      android:layout_alignParentTop="true" 
      .......... 
     /> 
</RelativeLayout>