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

The Archive Base Latest Questions

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

I am using the Gallery UI controller to provide a full-screen slideshow. It is

  • 0

I am using the Gallery UI controller to provide a full-screen slideshow.
It is setup to display only on photo at the time.

The standard transistion between is to slide-out the old photo and slide-in the new.
This is smooth and works good on most platforms, but I having some performance problems on other (with very high resolution).

My workaround would be to use a different transition, preferable fade-out and fade-in.

I’ve already extended the Gallery control and have overwritten the
onKeyDown method.

By using the setSelection I am able to skip the default transition, but I am not able to include my on transition.

Has any one added a different transition to the Gallery component?

Is there another component which might give me better results?

Gallery source: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.1_r2/android/widget/Gallery.java

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

    Think, I’ve managed to crack this nut.
    The strategy is as follows:

    1. All items in the Gallery must have a ViewAnimator as root.
    2. Extend the standard Gallery, and overwrite onKeyDown
    3. Make sure onKeyDown is used from the Gallery after a time job for example gallery.onKeyDown(KeyEvent.KEYCODE_DPAD_RIGHT, new KeyEvent(0,0));
    4. When the key is captured in the extended Gallery, get the current View which is an instance of ViewAnimator, get the next view from the Gallery’s adapter and create an animation to the next view
    5. Once the animation is done, call setSelection(getSelectedItemPosition()+1); (it is needed to be checked for wrapping)

    Here is an early Proof of concept that works, although it is missing some checks.

    <ViewAnimator 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/slideshow_animator"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    
    
    
    package com.elsewhat.slideshow.api;
    
    
    
    public class CustomGallery extends Gallery implements AnimationListener {
    boolean mDoTransition=false;
    
    public CustomGallery(Context context) {
        super(context);
    }
    
    public CustomGallery(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    
    public CustomGallery(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see android.widget.Gallery#onKeyDown(int, android.view.KeyEvent)
     */
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(mDoTransition==true){
            //leave the transition to the super class
            return super.onKeyDown(keyCode, event);
        }else {
            //handle the switch without transition ourselves
            switch (keyCode) {
            case KeyEvent.KEYCODE_DPAD_LEFT:
                //to be implemented similar as below
                return true;
    
            case KeyEvent.KEYCODE_DPAD_RIGHT:
                if (getCount() > 0 && getSelectedItemPosition() < getCount() - 1) {
                    View currentView = getSelectedView();
    
                    View unboundNewView= getAdapter().getView(getSelectedItemPosition()+1, null, null);
    
    
    
                    ViewAnimator viewAnimator = (ViewAnimator)currentView;
                    Animation inAnimation = new AlphaAnimation(0.0f, 1.0f);
                    inAnimation.setDuration(1000);
                    inAnimation.setAnimationListener(this);
                    viewAnimator.setInAnimation(inAnimation);
    
                    Animation outAnimation = new AlphaAnimation(1.0f, 0.0f);
                    outAnimation.setDuration(1000);
                    viewAnimator.setOutAnimation(outAnimation);
    
                    viewAnimator.addView(unboundNewView);
                    viewAnimator.showNext();
    
    
                }
                return true;
    
            case KeyEvent.KEYCODE_DPAD_CENTER:
            case KeyEvent.KEYCODE_ENTER:
            }
    
            return super.onKeyDown(keyCode, event);
        }
    
    }
    
    public void setDoTransition(boolean doTransition){
        mDoTransition= doTransition;
    }
    
    public boolean getDoTransition(){
        return mDoTransition;
    }
    
    @Override
    public void onAnimationEnd(Animation arg0) {
        setSelection(getSelectedItemPosition()+1);
    
    }
    
    @Override
    public void onAnimationRepeat(Animation animation) {
        // TODO Auto-generated method stub
    
    }
    
    @Override
    public void onAnimationStart(Animation animation) {
        // TODO Auto-generated method stub
    
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way creating a photo gallery using Listview control ? Im playing
I am only using Three20 for a gallery in my app. When I push
I am using the gallery widget to display images: <Gallery android:id=@+id/gallery android:layout_width=fill_parent android:layout_height=fill_parent android:layout_above=@+id/viewonline
I'm creating a standard image gallery using FancyBox. The page shows a list of
I have created a photo gallery application using Three20 framework. It works fine with
We are using SuperSlidShow Plugin to display gallery of images in our post. However
I have a simple gallery style link setup using image swap on hover that
I've been playing around with using Paperclip to build a photo gallery/store. A Gallery
I created a gallery using setInterval fiddle The gallery works great, the only problem
I am creating a photo gallery using jquery. I am taking and resizing 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.