by smarteist

Android Auto Image Slider

542 Stars 188 Forks Last release: 4 months ago (1.3.9) Apache License 2.0 119 Commits 13 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Android image slider

Download Android Arsenal Apk

API License

This is an amazing image slider for the Android .

You can easily load images with your custom layout, and there are many kinds of amazing animations you can choose.

     implementation 'com.github.smarteist:autoimageslider:1.3.9'

If you are using appcompat libraries use this one, but please migrate to androidx as soon as you can.

     implementation 'com.github.smarteist:autoimageslider:1.3.9-appcompat'

New Feautures

  • Ability to disable default indicator.

New Changes

  • Auto cycle bugs fixed.
  • Swiping debounce implemented.


Integration guide

First put the slider view in your layout xml :


Or you can put it inside the cardView to look more beautiful :


           <com.smarteist.autoimageslider.sliderview android:id="@+id/imageSlider" android:layout_width="match_parent" android:layout_height="300dp" app:slideranimationduration="600" app:sliderautocycledirection="back_and_forth" app:sliderautocycleenabled="true" app:sliderindicatoranimationduration="600" app:sliderindicatorgravity="center_horizontal|bottom" app:sliderindicatormargin="15dp" app:sliderindicatororientation="horizontal" app:sliderindicatorpadding="3dp" app:sliderindicatorradius="2dp" app:sliderindicatorselectedcolor="#5A5A5A" app:sliderindicatorunselectedcolor="#FFF" app:sliderscrolltimeinsec="1" app:sliderstartautocycle="true"></com.smarteist.autoimageslider.sliderview>


Next step

The new version requires an slider adapter plus your custom layout for slider items, Although its very similar to RecyclerView & RecyclerAdapter, and it's familiar and easy to implement this adapter... here is an example for adapter implementation :

public class SliderAdapterExample extends
        SliderViewAdapter {

private Context context;
private List<slideritem> mSliderItems = new ArrayList&lt;&gt;();

public SliderAdapterExample(Context context) {
    this.context = context;

public void renewItems(List<slideritem> sliderItems) {
    this.mSliderItems = sliderItems;

public void deleteItem(int position) {

public void addItem(SliderItem sliderItem) {

public SliderAdapterVH onCreateViewHolder(ViewGroup parent) {
    View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.image_slider_layout_item, null);
    return new SliderAdapterVH(inflate);

public void onBindViewHolder(SliderAdapterVH viewHolder, final int position) {

    SliderItem sliderItem = mSliderItems.get(position);


    viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Toast.makeText(context, "This is item in position " + position, Toast.LENGTH_SHORT).show();

public int getCount() {
    //slider view count could be dynamic size
    return mSliderItems.size();

class SliderAdapterVH extends SliderViewAdapter.ViewHolder {

    View itemView;
    ImageView imageViewBackground;
    ImageView imageGifContainer;
    TextView textViewDescription;

    public SliderAdapterVH(View itemView) {
        imageViewBackground = itemView.findViewById(;
        imageGifContainer = itemView.findViewById(;
        textViewDescription = itemView.findViewById(;
        this.itemView = itemView;

} </slideradapterexample.slideradaptervh>

Set the adapter to the Sliderview

After the instantiating of the sliderView (inside the activity or fragment with findViewById|BindView blah blah...), set the adapter to the slider.

    sliderView.setSliderAdapter(new SliderAdapterExample(context));

You can call this method if you want to start flipping automatically and you can also set up the slider animation :


Elaborate more?

Here is a more realistic and more complete example :

        protected void onCreate(Bundle savedInstanceState) {

        SliderView sliderView = findViewById(;

        SliderAdapterExample adapter = new SliderAdapterExample(this);


        sliderView.setIndicatorAnimation(IndicatorAnimationType.WORM); //set indicator animation by using IndicatorAnimationType. :WORM or THIN_WORM or COLOR or DROP or FILL or NONE or SCALE or SCALE_DOWN or SLIDE and SWAP!!
        sliderView.setScrollTimeInSec(4); //set scroll delay in seconds :



Suggestions and pull requests are always welcome. Special Thanks Roman Danylyk for nice indicator!


Copyright [2019] [Ali Hosseini]

Licensed under the Apache License, Version 2.0; you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.