Skip to content

Instantly share code, notes, and snippets.

@exhuma
Created May 15, 2015 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exhuma/125ec8a5e32b395fd786 to your computer and use it in GitHub Desktop.
Save exhuma/125ec8a5e32b395fd786 to your computer and use it in GitHub Desktop.
"Flowing" RecyclerView
public class LostMobile extends Activity {
// [... snip ...]
mMainRecycler = (RecyclerView) findViewById(R.id.mainList);
mMainRecycler.setHasFixedSize(true);
mMainRecycler.setLayoutManager(new LinearLayoutManager(this));
mMainListAdapter = new MyAdapter(this, remoteMap);
// [... snip ...]
mMainRecycler.setAdapter(mMainListAdapter);
mBeforeRecycler = (RecyclerView) findViewById(R.id.beforeItemsList);
mBeforeRecycler.setLayoutManager(new LinearLayoutManager(this));
mBeforeItemsAdapter = new MiniStatesAdapter(this, remoteMap);
mBeforeRecycler.setAdapter(mBeforeItemsAdapter);
mAfterRecycler = (RecyclerView) findViewById(R.id.afterItemsList);
mAfterRecycler.setLayoutManager(new LinearLayoutManager(this));
mAfterItemsAdapter = new MiniStatesAdapter(this, remoteMap);
mAfterRecycler.setAdapter(mAfterItemsAdapter);
// [... snip ...]
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ProgressBar
android:id="@+id/progressSpinner"
style="?android:attr/progressBarStyleLarge"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<android.support.v7.widget.RecyclerView
android:id="@+id/beforeItemsList"
android:scrollbars="vertical"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/mainList"
android:scrollbars="vertical"
android:layout_width="0dp"
android:layout_weight="10"
android:layout_height="match_parent"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/afterItemsList"
android:scrollbars="vertical"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"/>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@id/statusIcon"
android:maxHeight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment