6
6
7
7
This is an amazing image slider for the Android .
8
8
9
- You can easily load images from an internet URL, drawable, or file. And there are many kinds of amazing animations you can choose.
9
+ You can easily load images with your custom layout, And there are many kinds of amazing animations you can choose.
10
10
11
- implementation 'com.github.smarteist:autoimageslider:1.3.1 '
11
+ implementation 'com.github.smarteist:autoimageslider:1.3.2 '
12
12
13
13
### New Feautures
14
14
* Added new adapter based slider view, Provides the ability to add custom views
15
15
* Bugs fixed
16
+ * Fixed animation issues
17
+ * Indicator attributes added
16
18
* Migrated to androidx
17
19
18
20
# Demo
@@ -27,10 +29,23 @@ Just put the view in the layout xml like this:
27
29
28
30
``` xml
29
31
<com .smarteist.autoimageslider.SliderView
30
- android : layout_width =" match_parent"
31
- android : layout_height =" 300dp"
32
- android : layout_alignParentTop =" true"
33
- android : id =" @+id/imageSlider" />
32
+ android : id =" @+id/imageSlider"
33
+ android : layout_width =" match_parent"
34
+ android : layout_height =" 300dp"
35
+ app : sliderAnimationDuration =" 600"
36
+ app : sliderAutoCycleDirection =" back_and_forth"
37
+ app : sliderAutoCycleEnabled =" true"
38
+ app : sliderCircularHandlerEnabled =" true"
39
+ app : sliderIndicatorAnimationDuration =" 600"
40
+ app : sliderIndicatorGravity =" center_horizontal|bottom"
41
+ app : sliderIndicatorMargin =" 15dp"
42
+ app : sliderIndicatorOrientation =" horizontal"
43
+ app : sliderIndicatorPadding =" 3dp"
44
+ app : sliderIndicatorRadius =" 2dp"
45
+ app : sliderIndicatorSelectedColor =" #5A5A5A"
46
+ app : sliderIndicatorUnselectedColor =" #FFF"
47
+ app : sliderScrollTimeInSec =" 1"
48
+ app : sliderStartAutoCycle =" true" />
34
49
```
35
50
36
51
Or you can wrap it in a cardView :
@@ -43,10 +58,23 @@ Just put the view in the layout xml like this:
43
58
android : layout_height =" wrap_content" >
44
59
45
60
<com .smarteist.autoimageslider.SliderView
46
- android : layout_width =" match_parent"
47
- android : layout_height =" 300dp"
48
- android : layout_alignParentTop =" true"
49
- android : id =" @+id/imageSlider" />
61
+ android : id =" @+id/imageSlider"
62
+ android : layout_width =" match_parent"
63
+ android : layout_height =" 300dp"
64
+ app : sliderAnimationDuration =" 600"
65
+ app : sliderAutoCycleDirection =" back_and_forth"
66
+ app : sliderAutoCycleEnabled =" true"
67
+ app : sliderCircularHandlerEnabled =" true"
68
+ app : sliderIndicatorAnimationDuration =" 600"
69
+ app : sliderIndicatorGravity =" center_horizontal|bottom"
70
+ app : sliderIndicatorMargin =" 15dp"
71
+ app : sliderIndicatorOrientation =" horizontal"
72
+ app : sliderIndicatorPadding =" 3dp"
73
+ app : sliderIndicatorRadius =" 2dp"
74
+ app : sliderIndicatorSelectedColor =" #5A5A5A"
75
+ app : sliderIndicatorUnselectedColor =" #FFF"
76
+ app : sliderScrollTimeInSec =" 1"
77
+ app : sliderStartAutoCycle =" true" />
50
78
51
79
</androidx .cardview.widget.CardView>
52
80
```
@@ -138,19 +166,25 @@ Here is a more realistic and more complete example :
138
166
``` java
139
167
140
168
@Override
141
- protected void onCreate(Bundle savedInstanceState) {
142
- super . onCreate(savedInstanceState);
143
- setContentView(R . layout. activity_main);
144
-
145
- SliderView sliderView = findViewById(R . id. imageSlider);
146
-
147
- sliderView. setSliderAdapter(new SliderAdapterExample (this ));
148
-
149
- sliderView. setIndicatorAnimation(IndicatorAnimations . SWAP ); // set indicator animation by using SliderLayout.IndicatorAnimations. :WORM or THIN_WORM or COLOR or DROP or FILL or NONE or SCALE or SCALE_DOWN or SLIDE and SWAP!!
150
- sliderView. setSliderTransformAnimation(SliderAnimations . DEPTHTRANSFORMATION );
151
- sliderView. setScrollTimeInSec(2 ); // set scroll delay in seconds :
152
- sliderView. startAutoCycle();
153
- }
169
+ protected void onCreate(Bundle savedInstanceState) {
170
+ super . onCreate(savedInstanceState);
171
+ setContentView(R . layout. activity_main);
172
+
173
+ SliderView sliderView = findViewById(R . id. imageSlider);
174
+
175
+ SliderAdapterExample adapter = new SliderAdapterExample (this );
176
+
177
+ sliderView. setSliderAdapter(adapter);
178
+
179
+ sliderView. setIndicatorAnimation(IndicatorAnimations . WORM ); // set indicator animation by using SliderLayout.IndicatorAnimations. :WORM or THIN_WORM or COLOR or DROP or FILL or NONE or SCALE or SCALE_DOWN or SLIDE and SWAP!!
180
+ sliderView. setSliderTransformAnimation(SliderAnimations . SIMPLETRANSFORMATION );
181
+ sliderView. setAutoCycleDirection(SliderView . AUTO_CYCLE_DIRECTION_BACK_AND_FORTH );
182
+ sliderView. setIndicatorSelectedColor(Color . WHITE );
183
+ sliderView. setIndicatorUnselectedColor(Color . GRAY );
184
+ sliderView. setScrollTimeInSec(4 ); // set scroll delay in seconds :
185
+ sliderView. startAutoCycle();
186
+
187
+ }
154
188
```
155
189
156
190
# Contribute
0 commit comments