Slider Library is simple for creating beatiful UI for image sliding in circular view. Sliding them in both left and right with the help of buttons, texts etc. Easy to implement on your device.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.AjaySharvesh3:Image-Slider-View:v1.0'
}
<com.wolfpack.ajays.slider.Slider
android:id="@+id/slider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:layout_centerHorizontal="true"/>
slider = findViewById(R.id.slider);
int [] id = new int [] {R.drawable.dogone, R.drawable.dogtwo, R.drawable.dogthree};
slider.setImageResource(id);
5. Now you need to command this view when you want to slide to next item. So you can call helper method like:
//Slide image in left
slider.slideLeft();
//Slide image in right
slider.slideRight();
Just call .setSlideListener
method and pass the implementation slider.SlideListener
interface.
slider.setSlideListener(new Slider.SlideListener() {
@Override
public void onReachedFirst() {
Toast.makeText(MainActivity.this,"Reached 1st Position!",Toast.LENGTH_LONG).show();
}
@Override
public void onReachedLast() {
Toast.makeText(MainActivity.this,"Reached last Position!", Toast.LENGTH_LONG).show();
}
});
slider.setColor(Color.parseColor("#009988"));
Any contributions are welcome. You can send PR or open issues.