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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:49:27+00:00 2026-06-15T11:49:27+00:00

I have done enough searching and finally I am asking this question. I am

  • 0

I have done enough searching and finally I am asking this question.

I am converting gallery of imageviews into Viewpager backed up by PagerAdapter. I was able to achieve this:-

enter image description here

In onpageselected I am getting the position which I am using to get the red border.

Problem:-
Only the left most imageview is returned in onpageselected(). The rightmost imageview can never come to left and thus cannot be selected. Further on touching an imageview onpageselected() does not get called. It only gets called when you swipe it.

Questions:-
How to centre the selected imageview?
How to get the imageview position on touching it?

  • 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-06-15T11:49:29+00:00Added an answer on June 15, 2026 at 11:49 am

    Thanks to NathanZ he gave me some direction. Finally I had to set a OnClickListener() on the ImageView not the ViewPager.

        public Object instantiateItem(ViewGroup container, int position) {
            // TODO Auto-generated method stub
            MyImageView grpView = new MyImageView(ctxt);
            final int temp=position;
            grpView.setOnClickListener(new OnClickListener()
            {
                @Override
                public void onClick(View v)
                {
                    pos=temp;//This is the value what I am interested in
                }
            });
            grpView.setLayoutParams(new LayoutParams((int)(109*density), (int)(109*density)));
    
            myViewPager.addView(grpView);
            return grpView;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've done enough Googling to know that if I have something like class SubObject
Have done quite a bit of searching for a guide (of any substance) for
I have done some looking and I found this: http://www.codeproject.com/Articles/14439/The-ScrollableListBox-Custom-Control-for-ASP-NET-2 but to me it
I have done some commits and pushed them into my repository. Then I did
I have done enough researching ,when logging in it does not redirect me to
I am certain I have done something wrong to make this happen. I am
I have tried searching for an answer to this but I cannot find anything
I have done a fair bit of searching and reading around but haven't found
I've done some searching (maybe I'm not describing my problem well enough) but haven't
I have done enough research and have decided to move the JavaScript to the

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.