Commit 0d4ed6b47ebb52f531d6a02d52af2f7035a56331

Authored by transpine
1 parent 5790b6ae

- add scrollbar to recyclerview

app/src/main/java/net/devfac/userstory/FragmentBookShelf.java
... ... @@ -39,22 +39,20 @@ public class FragmentBookShelf extends Fragment implements StateEventListener {
39 39 @Override
40 40 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
41 41 Logger.i("onCreateView BookShelf");
42   -// View v = inflater.inflate(R.layout.fragment_bookshelf, container, false);
43   - RecyclerView recyclerView = (RecyclerView)inflater.inflate(R.layout.recycler_book_shelf, container, false);
  42 +
  43 + View rootView = inflater.inflate(R.layout.recycler_book_shelf, container, false);
  44 +
  45 + RecyclerView recyclerView = (RecyclerView)rootView.findViewById(R.id.recycler_book_shelf);
44 46  
45 47 mBookShelfCursorAdapter = new BookShelfCursorAdapter(
46 48 getActivity(),
47 49 StateContext.getInstance(getActivity()).getDbOpenHelper().getCursor(), true);
48 50  
49   -// mBookshelf = (ListView)v.findViewById(R.id.listBookshelf);
50   -// mBookshelf.setAdapter(mBookShelfCursorAdapter);
51   -
52 51 setupRecyclerView(recyclerView);
53 52  
54 53 StateContext.getInstance(getActivity()).setStateEventListener(this);
55 54  
56   -// return v;
57   - return recyclerView;
  55 + return rootView;
58 56 }
59 57  
60 58 private void setupRecyclerView(RecyclerView recyclerView) {
... ...
app/src/main/res/layout/recycler_book_shelf.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2   -<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
3   - android:id="@+id/recycler_book_shelf"
  2 +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
4 3 android:layout_width="match_parent"
5   - android:layout_height="match_parent"/>
6 4 \ No newline at end of file
  5 + android:layout_height="match_parent"
  6 + android:orientation="vertical">
  7 +
  8 + <android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
  9 + android:id="@+id/recycler_book_shelf"
  10 + android:layout_width="match_parent" android:scrollbars="vertical"
  11 + android:layout_height="match_parent" />
  12 +
  13 +</FrameLayout>
7 14 \ No newline at end of file
... ...