0

私は Android ギャラリーを行っていImageViewます。フルスクリーンで画像を表示する必要があります。つまり、ImageView と重なる必要がありGalleryます。

問題は、 がImageView占有していない部分を が占めていることですがGallery、これを達成する方法がわかりません。

これは私のレイアウトです:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal"
    android:gravity="center_horizontal"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/GalleryImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center_horizontal"
        android:scaleType="fitXY" />

    <Gallery
        android:id="@+id/GalleryThumbnails"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/GalleryImage" />

</RelativeLayout>

よろしくお願いします!

4

1 に答える 1

1

その効果を得るには、layout_alignTop=[Reference] を使用できます。

このビューの上端を、指定されたアンカー ビュー ID の上端と一致させます。

<ImageView
    android:id="@+id/GalleryImage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_gravity="center_horizontal"
    android:scaleType="fitXY" />

<Gallery
    android:id="@+id/GalleryThumbnails"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/GalleryImage" />

効いている証拠

ここに画像の説明を入力

于 2012-04-16T13:12:16.177 に答える