带有可绘制拼贴的无限滚动背景
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);
}
});…暂无开放 Issues,或尚未同步最近议题。