Android自动圆形画廊
-
29-09-2019 - |
题
我有画廊小部件包含1-10张图像。我知道,当我划过屏幕时,图像从左到右滚动。我想要10个自动从第一个图像开始的自动圆形画廊,是否有任何自动圆形适配器或方式???
final Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(new ImageAdapter(this));
Animation animation = AnimationUtils.loadAnimation(this,
R.anim.rotate_indefinitely);
animation.getInterpolator();
animation.setDuration(1000);
animation.setStartOffset(200);
animation.setRepeatMode(2);
animation.setFillAfter(false);
animation.setFillEnabled(true);
g.setAnimation(animation);
g.startAnimation(animation);
但是我只看到第一个图像是动画的。
看看我的 视频 ...
解决方案
为返回Integer.max_value的getCount()方法返回integer.max_value的画廊编写SpinnerAdapter。然后,在返回getDropdownView()和getView()中的视图时,将实际项目的模拟应用于 position
争论。
其他提示
我实现了最简单的解决方案。只是 returns Integer.MAX_VALUE in it's getCount() method
这将使右侧无限池。使它双方pass Integer.MAX_VALUE/2 in the position of child in setSelection(position, animate)
凉爽的。
不隶属于 StackOverflow