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
- API > 11
- Support RecyclerView, ScrollView, ListView, WebView.
- Support pulltoRefresh,loadmore
You can download a sample APK
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'
}
--
simple to your proejct
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>
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);
Please fell free to contact me if there is any problem when using the library.
- email: [email protected]