Setting up a cover flow in Android

前端 未结 3 520
难免孤独
难免孤独 2021-01-01 07:42

I created an iphone application, and now I am consigned to do the same application in android. I used the OpenFlow from thefaj on github https://github.com/thefaj/OpenFlow

相关标签:
3条回答
  • 2021-01-01 08:10

    Extend Gallery, and override this method as so:

       protected boolean getChildStaticTransformation(View child, Transformation t) {
        t.clear();
        t.setTransformationType(Transformation.TYPE_MATRIX);
        final Matrix matrix = t.getMatrix();
        float childCenterPos = child.getLeft() + (child.getWidth() / 2f);
        float center = getWidth() / 2;
        float diff = Math.abs(center - childCenterPos);
        float scale = diff / getWidth();
    
        matrix.setScale(1 - (scale), 1 - (scale));
    
        return true;
    }
    

    Obviously you can do more interresting stuff with the matrix than just scaling, but this just as an example of how easy it can be done.

    0 讨论(0)
  • 2021-01-01 08:16

    Just came across http://code.google.com/p/android-coverflow/ which seems to be based in the inter-fuser code with some optimisations

    0 讨论(0)
  • 2021-01-01 08:35

    I used this code on my project http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html

    You can adapt it to load the contents from some datasource, it's not a hard work.

    0 讨论(0)
提交回复
热议问题