Skip to content

Commit

Permalink
Add Header Footer
Browse files Browse the repository at this point in the history
  • Loading branch information
laucherish committed Sep 7, 2017
1 parent 2be6963 commit bc966a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public void run() {
mRowNumber = 20;
myAdapter = new MyAdapter();
View headerView = LayoutInflater.from(this).inflate(R.layout.view_my_header, null);
View footerView = LayoutInflater.from(this).inflate(R.layout.view_my_footer, null);
myAdapter.addHeaderView(headerView);
myAdapter.addFooterView(footerView);
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
mRecyclerView.setAdapter(myAdapter);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/res/layout/view_my_footer.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="12dp"
android:text="This is footer"/>

<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@color/colorPrimary"/>

</LinearLayout>

0 comments on commit bc966a5

Please sign in to comment.