title: Freeze layout in RecyclerView
body: <p>In a android app, I am using <code>RecyclerView</code> to populate my data. I want to freeze the first row and scroll other rows. I am using slider view in first.</p>
  
  <p>Below is the code :</p>
  
  <p>Slider view,I need to freeze it in the screen, </p>
  
  <p>layout_image_slider.xml</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:custom="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;
  
      &lt;com.daimajia.slider.library.SliderLayout
          android:id="@+id/slider"
          android:layout_width="match_parent"
          android:layout_height="@dimen/slider_height"
          custom:indicator_visibility="invisible" /&gt;
  
      &lt;com.daimajia.slider.library.Indicators.PagerIndicator
          android:id="@+id/custom_indicator"
          style="@style/AppTheme.AndroidImageSliderCornerOvalBlue"
          android:layout_gravity="bottom|center_horizontal" /&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>DealAdapter.java</p>
  
  <pre><code> @Override
      public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          switch (viewType) {
              case SLIDER:
                  return new ViewHolderSlider(LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_image_slider, null));
              case DEAL:
                  return new ViewHolderDeal(LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_deal_item, null));
              default:
                  return null;
          }
      }
  </code></pre>
  
  <p>View binding, AllDealsFragment.java </p>
  
  <pre><code> @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View mView = inflater.inflate(R.layout.fragment_all_deals, container, false);
  
      mProgressBar = ProgressBar.getInstance(mView.findViewById(R.id.progress_container));
      mREM = new ResponseErrorMessageHandler(mContext, this);
      mREM.cancelable(false);
      mREM.showCancelButton(true);
  
      getBanners();
  
      RecyclerView mRecyclerView = (RecyclerView) mView.findViewById(R.id.rv_all_deals);
      mRecyclerView.setHasFixedSize(true);
  
      StaggeredGridLayoutManager mGridLayoutManager =
              new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL);
      mRecyclerView.setLayoutManager(mGridLayoutManager);
  
      mDealAdapter = new DealAdapter(mContext, mBanners, mDeals, this);
  
      //Add your adapter to the sectionAdapter
      SimpleSectionedRecyclerViewAdapter.Section[] dummy =
              new SimpleSectionedRecyclerViewAdapter.Section[mSections.size()];
  
      mSectionedAdapter = new SimpleSectionedRecyclerViewAdapter(
              mContext, R.layout.layout_deal_header_item, R.id.tvTitle,mDealAdapter);
      mSectionedAdapter.setSections(mSections.toArray(dummy));
  
      //Apply this adapter to the RecyclerView
      mRecyclerView.setAdapter(mSectionedAdapter);
  </code></pre>
  
  <p>fragment_all_deals.xml</p>
  
  <pre><code> &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
  
          &lt;android.support.v7.widget.RecyclerView
              android:id="@+id/rv_all_deals"
              android:layout_width="match_parent"
              android:layout_height="match_parent" /&gt;
  
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Updated ::</p>
  
  <pre><code>    class ViewHolderSlider extends RecyclerView.ViewHolder {
  
              public SliderLayout mSlider;
  
              public ViewHolderSlider(View itemView) {
                  super(itemView);
                  mSlider = (SliderLayout) itemView.findViewById(R.id.slider);
                  mSlider.setPresetTransformer(SliderLayout.Transformer.ZoomOutSlide);
                  mSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Top);
                  mSlider.setCustomAnimation(new DescriptionAnimation());
                  mSlider.setCustomIndicator((PagerIndicator) itemView.findViewById(R.id.custom_indicator));
                  mSlider.setDuration(5000);
              }
          }
  
  
  logs ::
  06-12 15:23:49.990 1377-1377/com.syncbridge.colombodeals E/AndroidRuntime: FATAL EXCEPTION: main
                                                                             Process: com.syncbridge.colombodeals, PID: 1377
                                                                             java.lang.NullPointerException: Attempt to invoke virtual method 'void com.daimajia.slider.library.SliderLayout.setPresetTransformer(com.daimajia.slider.library.SliderLayout$Transformer)' on a null object reference
                                                                                 at com.syncbridge.colombodeals.adapters.DealAdapter$ViewHolderSlider.&lt;init&gt;(DealAdapter.java:186)
                                                                                 at com.syncbridge.colombodeals.adapters.DealAdapter.onCreateViewHolder(DealAdapter.java:58)
                                                                                 at com.syncbridge.colombodeals.adapters.SimpleSectionedRecyclerViewAdapter.onCreateViewHolder(SimpleSectionedRecyclerViewAdapter.java:69)
                                                                                 at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6290)
                                                                                 at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5478)
                                                                                 at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5363)
                                                                                 at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5359)
                                                                                 at android.support.v7.widget.LayoutState.next(LayoutState.java:100)
                                                                                 at android.support.v7.widget.StaggeredGridLayoutManager.fill(StaggeredGridLayoutManager.java:1574)
                                                                                 at android.support.v7.widget.StaggeredGridLayoutManager.onLayoutChildren(StaggeredGridLayoutManager.java:684)
                                                                                 at android.sup
  </code></pre>