Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This lib can be used for viewpager infinite loop with indicator easily.

Notifications You must be signed in to change notification settings

hemiy/InfiniteIndicator

Repository files navigation

InfiniteIndicator

This project is inspired by the android-auto-scroll-view-pager of Trinea. Use the salvage lib implement view recycle adapter.It contains two style.One is CircleIndicator seperated from Android-ViewPagerIndicator.Another is copy from CircleIndicator.You can custome style and animation.

Screenshot

Screenshot

Demo Download

APK Donwload

Setting

  • setInterval(long) set interval time of scroll in milliseconds, default is DEFAULT_INTERVAL.
  • setDirection(int) set auto scroll direction, default is RIGHT.
  • setInfinite(boolean) set whether infinite scroll when auto scroll reaching the last or first item, default is true.
  • setScrollDurationFactor(double) set the factor by which the duration of sliding animation will change.
  • setStopScrollWhenTouch(boolean) set whether stop auto scroll when touching, default is true.
  • setIndicatorPosition set present position of indicator.
  • startAutoScroll() start auto scroll, delay time is getInterval().
  • startAutoScroll(int) start auto scroll delayed.
  • stopAutoScroll() stop auto scroll.

indicator_type:the style enum of Indicator

  • indicator_default CirCleIndicator
  • indicator_anim_circle AnimCircleIndicator
  • indicator_anim_line is AnimLineIndicator

You can custome different anim and set for indicator.

Usage

  • include this library, use
 <com.lightsky.infiniteindicator.InfiniteIndicatorLayout
 android:id="@+id/indicator_default_circle"
 app:indicator_type="indicator_anim_circle"
 android:layout_height="wrap_content"
 android:layout_weight="match_parent"/>
public class MainActivity extends Activity {
 private InfiniteIndicatorLayout mDefaultIndicator;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 mDefaultIndicator = (InfiniteIndicatorLayout)findViewById(R.id.indicator_default_circle);
 HashMap<String,String> url_maps = new HashMap<String, String>();
 url_maps = new HashMap<String, String>();
 url_maps.put("Page A", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/a.jpg");
 url_maps.put("Page B", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/b.jpg");
 url_maps.put("Page C", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/c.jpg");
 url_maps.put("Page D", "https://raw.githubusercontent.com/lightSky/InfiniteIndicator/master/res/d.jpg");
 for(String name : url_maps.keySet()){
 DefaultSliderView textSliderView = new DefaultSliderView(this);
 textSliderView
 .image(url_maps.get(name))
 .setScaleType(BaseSliderView.ScaleType.Fit)
 .setOnSliderClickListener(this);
 textSliderView.getBundle()
 .putString("extra",name);
 mDefaultIndicator.addSlider(textSliderView);
 }
 mDefaultIndicator.setIndicatorPosition(InfiniteIndicatorLayout.IndicatorPosition.Center_Bottom);
 mDefaultIndicator.startAutoScroll();
 }
 @Override
 protected void onPause() {
 super.onPause();
 mDefaultIndicator.stopAutoScroll();
 }
 @Override
 protected void onResume() {
 super.onResume();
 mDefaultIndicator.startAutoScroll();
 }
}

Thanks
android-auto-scroll-view-pager
AndroidImageSlider
CircleIndicator
Android-ViewPagerIndicator

About me
Weibo: light_sky
Blog: lightskystreet.com light_sky
Email: huberycarl@gmail.com

About

This lib can be used for viewpager infinite loop with indicator easily.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%

AltStyle によって変換されたページ (->オリジナル) /