StaggeredGridView changing item sizes on scroll
<p>I have run into this problem</p>

<p>Am using a staggered grid view and it has a combination of two columns and single columns..Something like this</p>

<p><a href="https://i.stack.imgur.com/BIPV4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BIPV4.png" alt="enter image description here"></a></p>

<p>everything works fine, until i scroll up and down a few times and it randomly changes to something like this</p>

<p><a href="https://i.stack.imgur.com/fB5oI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fB5oI.png" alt="enter image description here"></a></p>

<p>A few more scrolls and it ended up like this</p>

<p><a href="https://i.stack.imgur.com/lMurz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lMurz.png" alt="enter image description here"></a>
I have no idea why and its very random. I tried to do a notifyDataSetChanged each time the page is shown, and does'nt seem to do anything</p>

<p>This is the code for my dashboard</p>

<pre><code>public class DashboardStaggered extends Fragment {
    RecyclerView mRecyclerView;
    View v;
    MasonryAdapter adapter;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        Log.d("MASONRY", "onCreateView");
        super.onCreate(savedInstanceState);
        if(v==null) {
            Log.d("MASONRY", "v is NULL recreating");
            v = inflater.inflate(R.layout.activity_dashboard_staggered, container, false);
            setupRecyclerView();
        }else{
            Log.d("MASONRY", "v is NOT NULL");

        }

        return v;
    }

    private void setupRecyclerView(){
        mRecyclerView = (RecyclerView) v.findViewById(R.id.masonry_grid);
        mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
        adapter = new MasonryAdapter(getActivity(),this);
        mRecyclerView.setAdapter(adapter);
        SpacesItemDecoration decoration = new SpacesItemDecoration(12);
        mRecyclerView.addItemDecoration(decoration);
        adapter.notifyDataSetChanged();

    }
    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
    }

    @Override
    public void onResume() {
        super.onResume();
        Log.d("MASONRY", "onResume");
        if(mRecyclerView==null) {
            setupRecyclerView();
        }



    }
    @Override
    public void onPause() {
        super.onPause();
        Log.d("MASONRY", "onPause");

    }

}
</code></pre>

<p>If needed i could post the adapter too. Any suggestions are highly appreciated folks.</p>

<p>Adapter code here(don't want to make the post messy) <a href="http://pastebin.com/QkZbjjp1" rel="nofollow noreferrer">http://pastebin.com/QkZbjjp1</a></p>

<p>Trimmed code <a href="http://pastebin.com/Hgsji1RG" rel="nofollow noreferrer">http://pastebin.com/Hgsji1RG</a></p>