Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.cindodcindy.imagesliderfrgament;
- import android.graphics.Color;
- import android.os.Bundle;
- import androidx.fragment.app.Fragment;
- import androidx.recyclerview.widget.LinearLayoutManager;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.LinearLayout;
- import com.smarteist.autoimageslider.IndicatorAnimations;
- import com.smarteist.autoimageslider.SliderAnimations;
- import com.smarteist.autoimageslider.SliderView;
- /**
- * A simple {@link Fragment} subclass.
- */
- public class BlankFragment extends Fragment {
- public BlankFragment() {
- // Required empty public constructor
- }
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Inflate the layout for this fragment
- // setContentView(R.layout.fragment_blank);
- View view = inflater.inflate(R.layout.fragment_blank, container, false);
- SliderView sliderView = view.findViewById(R.id.imageSlider);//as recycleview
- SliderAdpater adapter = new SliderAdpater(getActivity());//as adpater class
- sliderView.setSliderAdapter(adapter);
- sliderView.setSliderAdapter(adapter);
- 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!!
- sliderView.setSliderTransformAnimation(SliderAnimations.SIMPLETRANSFORMATION);
- sliderView.setAutoCycleDirection(SliderView.AUTO_CYCLE_DIRECTION_BACK_AND_FORTH);
- sliderView.setIndicatorSelectedColor(Color.WHITE);
- sliderView.setIndicatorUnselectedColor(Color.GRAY);
- sliderView.setScrollTimeInSec(4); //set scroll delay in seconds :
- sliderView.startAutoCycle();
- return view;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement