ManuelPeinado / FadingActionBar

Android library implementing a fading effect for the action bar, similar to the one found in the Play Music app
Apache License 2.0
2.87k stars 675 forks source link

Add support for RecyclerView #65

Open patjackson52 opened 10 years ago

patjackson52 commented 10 years ago

Now that Google has announced RecyclerView in the supportLib it would be great to have use FAB with this new view.

afollestad commented 10 years ago

This would be important to have before the L release, too

elifazio commented 9 years ago

I`m needing this one too... I have dig a little deeper and recyclerview inherits direct from ViewGroup. Any idea on this? maybe it is easy to add support. It throws some error on focusable methods....

java.lang.NullPointerException at android.support.v7.widget.RecyclerView.addFocusables(RecyclerView.java:1486) at android.view.ViewGroup.addFocusables(ViewGroup.java:797) at android.view.ViewGroup.addFocusables(ViewGroup.java:797) at android.view.ViewGroup.addFocusables(ViewGroup.java:778) at android.view.View.getFocusables(View.java:5185) at android.view.FocusFinder.findNextFocus(FocusFinder.java:114) at android.view.FocusFinder.findNextFocus(FocusFinder.java:98) at android.widget.ScrollView.onRequestFocusInDescendants(ScrollView.java:1357) at android.view.ViewGroup.requestFocus(ViewGroup.java:2113) at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2154) at android.view.ViewGroup.requestFocus(ViewGroup.java:2110) at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2154) at android.view.ViewGroup.requestFocus(ViewGroup.java:2110) at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2154) at android.view.ViewGroup.requestFocus(ViewGroup.java:2110) at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2154) at android.view.ViewGroup.requestFocus(ViewGroup.java:2110) at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2154) at android.view.ViewGroup.requestFocus(ViewGroup.java:2110) at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2154) at android.view.ViewGroup.requestFocus(ViewGroup.java:2113) at android.view.View.requestFocus(View.java:5323)

471448446 commented 9 years ago

FATAL EXCEPTION: main Process: com.example.testmaterial, PID: 3263 java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.support.v7.widget.RecyclerView$LayoutManager.onAddFocusables(android.support.v7.widget.RecyclerView, java.util.ArrayList, int, int)' on a null object reference at android.support.v7.widget.RecyclerView.addFocusables(RecyclerView.java:1486) at android.view.ViewGroup.addFocusables(ViewGroup.java:1069) at android.view.ViewGroup.addFocusables(ViewGroup.java:1069) at android.view.ViewGroup.addFocusables(ViewGroup.java:1069) at android.view.View.addFocusables(View.java:7359) at android.view.FocusFinder.findNextFocus(FocusFinder.java:92) at android.widget.ScrollView.onRequestFocusInDescendants(ScrollView.java:1454) at android.view.FocusFinder.findNextFocus(FocusFinder.java:65)

471448446 commented 9 years ago

how can i solve this??

afollestad commented 9 years ago

You need to set a layout manager to your recycler view before setting an adapter or anything else

niteshkhilwani commented 9 years ago

Hello,

I tried adding recyclerview in Content area. Now parallex is not working. Can you suggestion someething please.

FadingActionBarHelper helper = new FadingActionBarHelper() .actionBarBackground(R.drawable.ab_background_light) .headerLayout(R.layout.header) .contentLayout(R.layout.content); setContentView(helper.createView(this)); helper.initActionBar(this);

    mRecyclerView = (RecyclerView)findViewById(R.id.recycler_view);
    //mRecyclerView.setHasFixedSize(true);
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new CardAdapter();
    mRecyclerView.setAdapter(mAdapter);

<android.support.v7.widget.RecyclerView
    android:id="@+id/recycler_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>