任何人都已经实现了像下面的carousel
? 注意:项目列表不应重复,意味着在到达最后一个项目后不应先到达。请帮助我。像列表视图滚动一样的传送视图实现
[编辑]
我不想使用的ListView这一点。 任何人都可以帮助我解决这个问题。谢谢...
任何人都已经实现了像下面的carousel
? 注意:项目列表不应重复,意味着在到达最后一个项目后不应先到达。请帮助我。像列表视图滚动一样的传送视图实现
[编辑]
我不想使用的ListView这一点。 任何人都可以帮助我解决这个问题。谢谢...
这应该让你开始。重写你的ListView像这样:
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;
}
在getChildStaticTransformation您可以通过相应操作矩阵实现各种效果(甚至是3D)。 一个很好的教程(它使用的另一种技术,可以发现here
这可以使用自定义列表视图来实现。在列表活动中使用适配器将使其成为可能。一看here会让你更清楚。
你可以尝试与RecycleView链接是旋转木马:。Carousel DemoProject
看一看[此帖](HTTP://www.codeproject .com/Articles/146145/Android-3D-Carousel) – 2012-03-30 12:08:42
你做了那个项目吗?我需要垂直的,你可以分享一些示例代码吗? – 2012-08-20 09:00:16
@mustafa使用下面的Renard解决方案来处理垂直的。 – Noundla 2012-08-21 04:47:30