Image Slider Android Java
Image Slider Android Java:
XML :
<androidx.cardview.widget.CardView
android:layout_margin="5dp"
app:cardCornerRadius="8dp"
android:layout_below="@+id/marquee"
android:layout_width="match_parent"
android:layout_height="150dp">
<LinearLayout android:layout_width="match_parent"
android:layout_height="150dp">
<com.denzcoskun.imageslider.ImageSlider
android:id="@+id/image_slider"
android:layout_width="match_parent"
android:layout_height="150dp"
app:iss_auto_cycle="true"
app:iss_period="1000"
app:iss_delay="1000"
app:iss_text_align="CENTER"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
JAVA :
ImageSlider image_slider;
image_slider = findViewById(R.id.image_slider);
ArrayList<SlideModel> imageList = new ArrayList<>();
imageList.add(new SlideModel(R.drawable.m1, ScaleTypes.CENTER_CROP));
image_slider.setImageList(imageList);
Comments
Post a Comment