Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7602247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:21:51+00:00 2026-05-30T23:21:51+00:00

I have a Gallery with arrow indicators that show whether there are images to

  • 0

I have a Gallery with arrow indicators that show whether there are images to the left or right.

      <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@color/black"
        android:layout_weight="1" >
          <com.package.views.MyGallery
            android:id="@+id/carGallery"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:spacing="2dip"
            android:fadingEdge="none" />
          <ImageView
            android:id="@+id/prev"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:src="@drawable/left_orange_arrow"
            android:paddingLeft="25dip" />
          <ImageView
            android:id="@+id/next"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:src="@drawable/right_orange_arrow"
            android:paddingRight="25dip" />
      </RelativeLayout>

I update the arrows as such:

carGallery.setOnItemSelectedListener(new OnItemSelectedListener(){
    @Override
    public void onItemSelected(AdapterView<?> adapter, View view, final int position, long id) {
        Car car = carAdapter.getCar(position);
        top.setText(car.nickname);
        bottom.setText(car.year+" "+car.make+" "+car.model);

        if(carAdapter.getItems().size() == 1) {
            prev.setVisibility(View.GONE);
            next.setVisibility(View.GONE);
        }
        else if(position == 0) {
            prev.setVisibility(View.GONE);
            next.setVisibility(View.VISIBLE);
        }
        else if(position == carAdapter.getItems().size()-1) {
            prev.setVisibility(View.VISIBLE);
            next.setVisibility(View.GONE);
        }
        else {
            prev.setVisibility(View.VISIBLE);
            next.setVisibility(View.VISIBLE);
        }
    }
});

Any time I change the visibility of an arrow, the Gallery snaps to the item that just scrolled in to selection. I know that Gallery.onItemSelected() is causing the snapping because when I do Gallery.setCallbackDuringFling(false), it doesn’t do the snapping on a fling until the final item is selected.

What can I do to stop Gallery from snapping like this?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:21:53+00:00Added an answer on May 30, 2026 at 11:21 pm

    Here are a couple of links that address a similar problem, though it may not be the same as yours:

    http://code.google.com/p/android/issues/detail?id=16171

    Weird animation on Gallery when a invalidate is requested from it's children

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have custom gallery. Gallery represents items that are frame layout. There are one
I have gallery.php that loads images with src path from a database. I also
I have a gallery of images that i have set up and when a
I have a gallery that doesnt work properly with setTimeout. I need to make
I have photo gallery code that does image re-sizing and thumbnail creation. I use
I have a gallery that's loaded via a BaseAdapter . This works fine. I
I have a gallery of images on my website. Under each one, I'd like
I have an image gallery that I created by reading the contents inside a
I'm trying to get Fancybox to stop resizing images in the gallery. I have
I have used gallery widget to display downloaded images.But unfortunately I am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.