InnocentKiller
InnocentKiller

Reputation: 5234

How to get image zoomed automatically when focused while horizontally scrolling in android

I am trying to implement the above scenario described in the image, There were couple of designs like oval, star, rectangle, square and many more, when I will scroll that images, the center image should be zoom when it focused and when I scroll the images, the left images needs to be zoom out and of course right one also.

I have tried so many example of carousel android but it doesn't work for me. Also tried horizontal scrollview but the result remains same. I have implemented this example from github, Check the link

Upvotes: 1

Views: 1114

Answers (2)

Deep Mehta
Deep Mehta

Reputation: 1237

I have created a demo application for you and placed it on Github.

You can download this demo from below link:

I think this will surely work for you and all others who want this kind of sliders in Android.

Cheers,

Upvotes: 3

Pedro Oliveira
Pedro Oliveira

Reputation: 20500

Try using something like Viewflow and set a zoom animation in the OnViewSwitchListener. Something like:

viewflow.setOnViewSwitchListener(new ViewFlow.ViewSwitchListener() {
            @Override
            public void onSwitched(View view, int position) {
                view.animate().scaleY(1.2f).scaleX(1.2f).start();
            }
        });

Upvotes: 0

Related Questions