1
1
package in .goodiebag .example ;
2
2
3
- import androidx .appcompat .app .AppCompatActivity ;
4
- import androidx .viewpager .widget .ViewPager ;
3
+ import android .graphics .Typeface ;
5
4
import android .os .Bundle ;
6
5
import android .widget .TextView ;
7
6
7
+ import androidx .appcompat .app .AppCompatActivity ;
8
+ import androidx .viewpager .widget .ViewPager ;
9
+
8
10
import java .util .ArrayList ;
9
11
import java .util .List ;
10
12
@@ -25,19 +27,26 @@ protected void onCreate(Bundle savedInstanceState) {
25
27
26
28
List <CarouselPicker .PickerItem > imageItems = new ArrayList <>();
27
29
imageItems .add (new CarouselPicker .DrawableItem (R .drawable .i1 ));
28
- imageItems .add (new CarouselPicker .DrawableItem (R .drawable .i2 ));
30
+ imageItems .add (new CarouselPicker .DrawableItem (R .drawable .i2 , getResources (). getColor ( android . R . color . holo_red_light ) ));
29
31
imageItems .add (new CarouselPicker .DrawableItem (R .drawable .i3 ));
30
32
imageItems .add (new CarouselPicker .DrawableItem (R .drawable .i4 ));
31
33
CarouselPicker .CarouselViewAdapter imageAdapter = new CarouselPicker .CarouselViewAdapter (this , imageItems , 0 );
32
34
imageCarousel .setAdapter (imageAdapter );
33
35
34
36
List <CarouselPicker .PickerItem > textItems = new ArrayList <>();
35
- textItems .add (new CarouselPicker .TextItem ("hi" , 20 ));
36
- textItems .add (new CarouselPicker .TextItem ("hi" , 20 ));
37
- textItems .add (new CarouselPicker .TextItem ("hi" , 20 ));
37
+ textItems .add (new CarouselPicker .TextItem ("hi" , 20 ,
38
+ getResources ().getColor (android .R .color .holo_blue_bright ), Typeface .MONOSPACE ,
39
+ CarouselPicker .TextItem .FontStyle .BOLD_ITALIC ));
40
+ textItems .add (new CarouselPicker .TextItem ("hi, welcome to the carousel picker" , 20 ,
41
+ getResources ().getColor (android .R .color .holo_red_light ),
42
+ Typeface .SANS_SERIF , CarouselPicker .TextItem .FontStyle .NORMAL ));
43
+ textItems .add (new CarouselPicker .TextItem ("hi" , 20 ,
44
+ Typeface .SERIF , CarouselPicker .TextItem .FontStyle .ITALIC ));
38
45
textItems .add (new CarouselPicker .TextItem ("hi" , 20 ));
39
46
CarouselPicker .CarouselViewAdapter textAdapter = new CarouselPicker .CarouselViewAdapter (this , textItems , 0 );
40
47
textCarousel .setAdapter (textAdapter );
48
+ // set default color
49
+ textAdapter .setTextColor (getResources ().getColor (android .R .color .holo_green_light ));
41
50
42
51
List <CarouselPicker .PickerItem > mixItems = new ArrayList <>();
43
52
mixItems .add (new CarouselPicker .DrawableItem (R .drawable .i1 ));
0 commit comments