2012-02-24 9 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> 
関連する問題