Endless scrolling background with drawable tiling
Endless scrolling background with drawable tiling
Endless background scrolling for Android
Please note, that first GIF uses library: CCF to achive color-cross-fade effect, please refer to the sample project for more info.
| Version | Gradle |
|---|---|
compile 'ru.noties:sbv:x.x.x' |
A simple Android View that can help to achive endless scrolling background effect. It takes one drawable and tiles it to fill to the width & height of the view.
Custom attributes:
sbv_drawable - the drawable object to be usedsbv_scrollX - start scroll x valuesbv_scrollY - start scroll y valueThis view works with preview layout tools in Android Studio.
Next we need to redirect scroll events from our scrolling View to the ScrollingBackgroundView. The sample project contains some basic cases like RecyclerView & ViewPager.
…final RecyclerView recyclerView = findView(view, R.id.recycler_view);
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
scrollingBackgroundView.scrollBy(dx, dy);
}
});…No open issues yet, or sync has not completed.