How to create Vertical Carousel in android?

前端 未结 2 1322
既然无缘
既然无缘 2020-12-30 05:47

I want to implement vertical carousel in android.I have searched lot of things about it,Finally i found that horizontal carousel example here. Can any body know that how to

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-30 06:10

    This following code is used to display the carousel in vertical view. I just modified code in this url. http://www.codeproject.com/Articles/146145/Android-3D-Carousel .This is works fine for nexus-landscpape. And also i used this LINK to get view as vertical.

    private void Calculate3DPosition(CarouselItem child, int diameter,
                float angleOffset) {
            angleOffset = angleOffset * (float) (Math.PI / 180.0f);
            float y = (float) (diameter / 2 * Math.sin(angleOffset)) + diameter / 2
                    - child.getWidth() / 2;
            float z = diameter / 2 * (1.0f - (float) Math.cos(angleOffset));
            float x = (float) (-   diameter / 2 * Math.cos(angleOffset) * 0.5);
            child.setX(x + 250);
            child.setZ(z);
            child.setY(y - 150);
        }
    

提交回复
热议问题