turing-tech / MaterialScrollBar

An Android library that brings the Material Design 5.1 sidebar to pre-5.1 devices.
Apache License 2.0
778 stars 126 forks source link

MaterialScrollBar is not showing #16

Closed FastDr1v3r closed 9 years ago

FastDr1v3r commented 9 years ago

This is my code:

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
        savedInstanceState) {

    View view = inflater.inflate(R.layout.music_list_fragment_layout, container, false);

    recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
    materialScrollBar = new MaterialScrollBar(getActivity(), recyclerView, true);
    materialScrollBar.setHandleColour(R.color.accentColor);

    recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));

    musicRecyclerAdapter = new MusicRecyclerAdapter(getActivity(), pSongs);
    musicRecyclerAdapter.setMusicFragmentListener(this);
    recyclerView.setAdapter(musicRecyclerAdapter);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setItemAnimator(new DefaultItemAnimator());

    return view;
}

And here is the recyclerView's xml code:

   <android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:divider="@android:color/transparent"
    android:dividerHeight="8dp"
    android:scrollbars="vertical" />

English is not my native language so I think I lost myself here: "Also note that the library does not currently support recyclerViews which do not boarder the screen's edge on the right side." - from what I understood it means that I should apply a padding or margin to the right side of the recyclerview, but I tried that and it's not working. Can someone explain me what is wrong with my code? A short example of how to apply it properly to the recyclerview would be great, thanks!

FastDr1v3r commented 9 years ago

SOLVED: I was using a LinearLayout instead of RecyclerView.