简体   繁体   中英

how to add buttons to Gallery in Universal Android Image Loader?

I am working on a sample project and I am using the Universal Image Loader. UIL is great but I want to modify something, I just want to put buttons like Next / Previous in the Gallery.

But I can't see my Buttons view in the Gallery.

Here is the XML Layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Gallery Demo"
    android:id="@+id/txt"
    />
    <Gallery
    android:id="@+id/gallery"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:spacing="100px"
    android:scrollbars="horizontal"
    android:scrollbarFadeDuration="0"
    android:scrollX="100px"
    />
    <LinearLayout
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:orientation="horizontal"
     android:layout_marginTop="5px"
     >
     <Button
     android:text="Previous"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:id="@+id/btnPrev"
     android:onClick="onClick"
      />
      <Button
     android:text="Next"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:id="@+id/btnNext"
     android:onClick="onClick"
      />

    </LinearLayout> 

</LinearLayout>

It seems that the Gallery view is filling the whole space of the screen. Any ideas on how to do it?

Please check your I magePagerAdapter extends BaseAdapter imageview android:layout_width and android:layout_height , It may be Fill_parent or wrap_content.

If it wrap_content then if you image is big then it show in full screen.

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM