LinkageScrollLayout

A container which supports two view scrolling in it.

It's easy to use and powerful, as it support any two child view in it.

Support 'API LEVEL >= 19'

Download APK

Top is H5, Bottom is NA

  • WebView & RecyclerView

  • WebView & ListView

  • WebView & GridView

  • WebView & ScrollView

Top is NA, Bottom is H5

  • RecyclerView & WebView

Tos is NA, Bottom is NA

  • RecyclerView & ScrollView

  • ListView & RecyclerView

  • GridView & ReyclerView

  • ScrollView & GridView

Usage

in xml

<?xml version="1.0" encoding="utf-8"?>
<com.lorien.linkagescroll.LinkageScrollLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".activity.WVLVActivity">

    <com.lorien.linkagescroll.view.LWebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:overScrollMode="never"
        android:scrollbars="none"/>

    <com.lorien.linkagescroll.view.LListView
        android:id="@+id/listview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:overScrollMode="never"
        android:scrollbars="none"/>

</com.lorien.linkagescroll.LinkageScrollLayout>
  • you must use LinkageScrollLayout as you content layout in your activity or fragment.
  • LinkageScrollLayout only support two child to scroll.
  • I have override WebView, ListView, GridView, RecyclerView and ScrollView to provide necessary function which LinkageScrollLayout require. So you must use LWebView instead of WebView, LListView instead of ListView...
  • If you want to add other views into LinkageScrollLayout, you can refer to LWebView, LListView, LRecyclerView and so on.

UI Interface

you can use LinkageScrollListener to listen LinkageScroll Event.

example:

mLinkageLayout.addLinkageScrollListener(new LinkageScrollListenerAdapter() {
    @Override
    public void onTopJustIn(PosIndicator posIndicator) {
        // when top view move into layout, this function will be called
        Log.d(TAG, "onTopJustIn");
    }

    @Override
    public void onTopJustOut(PosIndicator posIndicator) {
        // when top view move out of layout, this function will be called
        Log.d(TAG, "onTopJustOut");
    }

    @Override
    public void onBottomJustIn(PosIndicator posIndicator) {
        // when bottom view move into layout, this function will be called
        Log.d(TAG, "onBottomJustIn");
    }

    @Override
    public void onBottomJustOut(PosIndicator posIndicator) {
        // when bottom view move out of layout, this function will be called
        Log.d(TAG, "onBottomJustOut");
    }

    @Override
    public void onPositionChanged(PosIndicator posIndicator) {
        // when The position of TopView and BottomView has changed, this function will be called
        Log.d(TAG, "onPositionChanged, postion: " + posIndicator.getCurrentPos());
    }
});

GitHub