Наложение изображений в галерее? - PullRequest
1 голос
/ 19 июня 2011

Я хотел бы добавить ImageButton к элементам галереи в функциональности наложения типа.В частности, я хотел бы, чтобы в верхней части каждого изображения в галерее располагалось 4 кнопки, которые запускали бы действия при их нажатии.

Большое спасибо за любую помощь или подсказку в этом вопросе.Ниже мой XML-файл.

    <include layout="@layout/topnav_bar"/>

            <!-- These are my buttons -->
    <include layout="@layout/topbuttons"/>


    <Gallery xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/runway"
        android:gravity="top"
        android:spacing="5dp"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"/>

    <include layout="@layout/bottomnav_bar"/>

Это мои TOPBUTTONS XML

    <ImageButton
    android:id="@+id/ibuy" 
    android:src="@drawable/ishop"
    android:onClick="@string/ibuy"
    android:scaleType="centerInside"
    android:layout_height="50dp" 
    android:layout_width="20dp" 
    android:layout_weight="1"/>
    <ImageButton 
    android:src="@drawable/izoom"
    android:scaleType="centerInside"
    android:layout_height="50dp" 
    android:layout_width="20dp" 
    android:layout_weight="1"/>
    <ImageButton 
    android:id="@+id/fblike"
    android:src="@drawable/ishare"
    android:onClick="@string/postToFaceBook"
    android:scaleType="centerInside"
    android:layout_height="50dp" 
    android:layout_width="20dp" 
    android:layout_weight="1"/>
    <ImageButton 
    android:id="@+id/ilove"
    android:src="@drawable/ilove"
    android:onClick="@string/rateIt"
    android:scaleType="centerInside"
    android:layout_height="50dp" 
    android:layout_width="20dp" 
    android:layout_weight="1"/>

1 Ответ

0 голосов
/ 19 июня 2011

Вам нужно использовать RelativeLayout, что-то в строках

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation= "vertical"
    >
    <include layout="@layout/topnav_bar"/>
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1">
        <!-- These are my buttons -->
        <include 
            layout="@layout/topbuttons"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            />
        <Gallery xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/runway"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentTop="true"
            />
    </RelativeLayout>        
    <include layout="@layout/bottomnav_bar"/>
</LinearLayout>
...