01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
package
com.image.galleryFlow;
import
android.app.Activity;
import
android.os.Bundle;
import
android.view.GestureDetector;
import
android.view.GestureDetector.SimpleOnGestureListener;
import
android.view.MotionEvent;
public
class
GalleryFlowActivity
extends
Activity {
private
GalleryFlow galleryFlow;
private
ImageAdapter adapter;
private
GestureDetector detector;
/** Called when the activity is first created. */
@Override
public
void
onCreate(Bundle savedInstanceState) {
super
.onCreate(savedInstanceState);
setContentView(R.layout.layout_gallery);
detector =
new
GestureDetector(
new
MyGestureListener());
int
[] images = { R.drawable.p01, R.drawable.p02, R.drawable.p03,
R.drawable.p04, R.drawable.p05 };
adapter =
new
ImageAdapter(
this
, images);
adapter.createReflectedImages();
galleryFlow = (GalleryFlow) findViewById(R.id.gallery_flow);
galleryFlow.setAdapter(adapter);
galleryFlow.setSelection(
1
);
}
private
class
MyGestureListener
extends
SimpleOnGestureListener {
@Override
public
boolean
onFling(MotionEvent e1, MotionEvent e2,
float
velocityX,
float
velocityY) {
// TODO Auto-generated method stub
int
currentPosition = galleryFlow.getSelectedItemPosition();
if
(e1.getX() - e2.getX() >
50
&& Math.abs(velocityX) >
100
) {
if
(currentPosition +
1
== adapter.getCount()) {
galleryFlow.setSelection(
0
);
}
else
{
galleryFlow.setSelection(currentPosition +
1
);
}
}
else
if
(e2.getX() - e1.getX() >
50
&& Math.abs(velocityX) >
100
) {
if
(currentPosition -
1
<
0
) {
galleryFlow.setSelection(adapter.getCount() -
1
);
}
else
{
galleryFlow.setSelection(currentPosition -
1
);
}
}
return
super
.onFling(e1, e2, velocityX, velocityY);
}
}
@Override
public
boolean
onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
return
detector.onTouchEvent(event);
}
}
|
20121014145 102_99011.png(116.56 KB, 下载次数: 26)
3D相册(Gallery 3D + 倒影效果) GalleryFlow 源代码 http://yuncode.net/code/c_507a610da229d27 ...
20121014145050_71959.png(100.57 KB, 下载次数: 1)
3D相册(Gallery 3D + 倒影效果) GalleryFlow 源代码 http://yuncode.net/code/c_507a610da229d27 ...
GalleryFlow.rar