1

My RecyclerView which lies in in a NestedScrollView doesn't show after setting adapter.

How can i make it show without creating an extra 'MyLayoutAdapter' or something.

Just seeked through this page but didn't find any solution for MyProblem: How to use RecyclerView inside NestedScrollView?

Xml File:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".ImageActivity"
tools:showIn="@layout/activity_image">

<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/image_recyclerview"
    android:background="#7c4949">


</android.support.v7.widget.RecyclerView>

Java File

public class ImageActivity extends AppCompatActivity {

File root;
int pos;

RecyclerView recyclerView;
RecyclerView.LayoutManager layoutManager;
ImageAdapter adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.onResume();


    setContentView(R.layout.activity_image);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);


    getSupportActionBar().setDisplayHomeAsUpEnabled(true);



    //RecyclerView
    recyclerView = (RecyclerView) findViewById(R.id.image_recyclerview);

    adapter = new ImageAdapter(root, pos);
    layoutManager = new GridLayoutManager(this,3);

    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setHasFixedSize(false);

    recyclerView.setAdapter(adapter);
    recyclerView.setLayoutManager(layoutManager);



}


}
Community
  • 1
  • 1

0 Answers0