Setting up a cover flow in Android

百般思念 提交于 2019-12-03 19:46:01

问题


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 ?


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/5655686/setting-up-a-cover-flow-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!