Setting up a cover flow in Android

2019-02-07 15:04发布

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

however I have yet to be able to find something with a working coverflow on the android..

Does anyone have experience with this in android or know a good place to start ?

3条回答
等我变得足够好
2楼-- · 2019-02-07 15:28

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.

查看更多
三岁会撩人
3楼-- · 2019-02-07 15:32

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

查看更多
够拽才男人
4楼-- · 2019-02-07 15:36

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.

查看更多
登录 后发表回答