/ScrollableLayout

An Android library supports sticking the navigator on the top when ItemView scrolls

Primary LanguageJavaApache License 2.0Apache-2.0

ScrollableLayout

An Android library supports sticking the navigator on the top when ItemView scrolls.

fork and change on https://github.com/cpoopc/ScrollableLayout

scrolling is not smooth, especially on some models .than 「 w446108264/StickHeaderLayout

gif

Art

Art

Art Art

Art Art

Features

  • API > 11
  • Support RecyclerView, ScrollView, ListView, WebView.
  • Support pulltoRefresh,loadmore

Samples

You can download a sample APK

Gradle Dependency

Users of your library will need add the jitpack.io repository:

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

and:

dependencies { 
    compile 'com.github.w446108264:ScrollableLayout:1.0.1'
}

--

Usage

simple to your proejct

Layout

the frist childview will be ticked on the top.

      <com.scrollablelayout.ScrollableLayout
        android:id="@+id/sl_root"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:background="#345"
            android:gravity="center"
            android:textColor="#fff"
            android:text="header" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#235"
            android:gravity="center"
            android:textColor="#fff"
            android:text="navigationbar" />

        <ListView
            android:id="@+id/vp_scroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#f1f1f1" />

    </com.scrollablelayout.ScrollableLayout>

Simple

        sl_root = (ScrollableLayout) findViewById(R.id.sl_root);
        listview = (ListView) findViewById(R.id.vp_scroll);
        int size = 100;
        String[] stringArray = new String[size];
        for (int i = 0; i < size; ++i) {
            stringArray[i] = ""+i;
        }
        ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, stringArray);
        listview.setAdapter(adapter);
        sl_root.getHelper().setCurrentScrollableContainer(listview);

Contact & Help

Please fell free to contact me if there is any problem when using the library.