我有一个Gallery小部件,它可以显示50dp高的布局。当用户点击图库项目时,该布局将增长到100dp高。我有这种不断扩展的行为可以很好地工作。但是,问题是库将项目呈现为水平和垂直居中。
我想要的是水平居中,顶部对齐。因此,当用户点击一个项目时,它看起来像是在"向下滚动"。
<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"
/>
尝试您的物品布局:
<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>