1

Anyone has implemented like the below carousel? Note: The list of items should not be repeated, means should not come to first after reaching the last item. Please help me on this.

carousel listview

[edited]

enter image description here

I don't want to use ListView for this. anyone help me on this. Thanks...

Noundla Sandeep
  • 3,334
  • 5
  • 29
  • 56
  • 1
    Have a look at [this post](http://www.codeproject.com/Articles/146145/Android-3D-Carousel) – Adil Soomro Mar 30 '12 at 12:08
  • did you make that project? I need vertical one, can you share some sample code? – Mustafa Güven Aug 20 '12 at 09:00
  • @mustafa use the below Renard solution for vertical one. – Noundla Sandeep Aug 21 '12 at 04:47
  • @noundla please forgive me but I dont understand where do I use those codes which shared by Renard. The thing what I want to do is exactly same the first picture you mentioned above and I need that very urgent. You mentioned the codes or sony's sample project for a solution? – Mustafa Güven Aug 21 '12 at 19:40
  • 1
    @noundla any idea about this http://stackoverflow.com/questions/20417882/list-view-with-change-width-of-row-when-scroll-android ? – kyogs Dec 31 '13 at 12:04

3 Answers3

4

this should get you started. Override your ListView like so:

private final Transformation mTransformation;

public ListView3d(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (!isInEditMode()) {
        setStaticTransformationsEnabled(true);
        mTransformation = new Transformation();
        mTransformation.setTransformationType(Transformation.TYPE_MATRIX);
    } else {
        mTransformation = null;
    }       
}

@Override
protected boolean getChildStaticTransformation(View child, Transformation t) {
    mTransformation.getMatrix().reset();
    final int childTop = Math.max(0,child.getTop());
    final int parentHeight = getHeight();
    final float scale = (float)(parentHeight-(childTop/2))/getHeight();
    Log.i("scale",scale+"");
    final float px = child.getLeft() + (child.getWidth()) / 2;
    final float py = child.getTop() + (child.getHeight()) / 2;
    mTransformation.getMatrix().postScale(scale, scale, px, py);
    t.compose(mTransformation);
    return true;
}

in getChildStaticTransformation you can achieve various effects (even 3d) by manipulating the matrix accordingly. A very good tutorial (which uses another technique can be found here.

Renard
  • 6,909
  • 2
  • 27
  • 23
  • By the above listview items are getting some space between one another based on the position. but i dont need that, so how can i remove that space.. – Noundla Sandeep Apr 03 '12 at 06:52
  • @Renard how can i achieved this one http://stackoverflow.com/questions/20417882/list-view-with-change-width-of-row-when-scroll-android ? – kyogs Dec 31 '13 at 12:02
1

this can be achieved using a custom list view. Using an adapter in a listactivity will make it possible. a look here will make it clearer for you.

Anurag Ramdasan
  • 4,189
  • 4
  • 31
  • 53
0

You can to try that carousel with RecycleView. Link : Carousel DemoProject

Dima Kozhevin
  • 3,602
  • 9
  • 39
  • 52