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 6860115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:22:05+00:00 2026-05-27T02:22:05+00:00

Actually i got a Gallery that shows my drawables and shows the item selected

  • 0

Actually i got a Gallery that shows my drawables and shows the item selected on the center of the screen.

I would like my selected item to be “off-center” (e.g: positioned 50dip on the left).

I tried to add some padding on the view and on the gallery. I also verified that the gravity of my gallery wasn’t set in “center”

By the way, I guess that the usual behaviour of the gallery is to show selected item on the center of the screen.

Is there any possible means to shift the position of the selected item ?

Thanks a lot ! If needed, I can add my code.

  • 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-27T02:22:06+00:00Added an answer on May 27, 2026 at 2:22 am

    I got the answer finally.

    First, you have to set ScrollX to a certain value corresponding to the interval of pixels you wanna have.

    But the problem with that only solution is that to select an item, you need to click on the center of the screen, which isn’t fair.

    Second, you must override Gallery, implement this one OnDoubleTapListener and add him a custom listener (called for instance onItemTapListener) like this :

    public void setOnTapItemMenuListener(OnTapItemMenuListener listener) {
         onTapItemMenuListener = listener;
    }
    

    I made an interface like this to implement my new listener :

    public interface OnTapItemMenuListener {
        public abstract void onTap(int intPosition);
    }
    

    And on the event “onSingleTapConfirmed” implemented because of the implementation of OnDoubleTapListener, you catch the event and verify that event.getX() is into a certain position, like this for instance :

    if (event.getX() / intWidth > 0.20f && event.getX() / intWidth < 0.45f) {
         Log.i("TAG", "onSingleTapConfirmed on the right area, we launch onTap for the Listener");
         onTapItemMenuListener.onTap(this.getSelectedItemPosition());
    } else {
         Log.i("TAG", "onSingleTapConfirmed on the wrong area, we don't launch onTap for the Listener");
    }
    

    Where intWidth is the width in pixels of the current screen.

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

Sidebar

Related Questions

I've got a TABLE that's actually being used for its intended purpose, to display
I've got a queue (actually 3 different queues but I don't believe that will
I've got an ASP document that 5 years old. Actually I'm working with PHP
I've got a sqlite table actions that looks something like this: uuid varchar (36)
I got a question ;) Actually I want to use core-data in different threads.
Actually I am confronted with a Problem. I've got a .apk-File in one Package
I've got to develop a multi-language code generator in C#. Well actually the idea
I've got XML coming back from an Ajax.Request in Ajax.Response.responseXML . My XML actually
I was actually going through the question 1636644 .. and got confused with this
Today I've got a stacktrace with a very strange error. Actually, I may be

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.