我低于异常-
Caused by: java.lang.IllegalStateException: RecyclerView has no LayoutManager
at android.support.v7.widget.RecyclerView.generateLayoutParams(RecyclerView.java:2820)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:757)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.peoplecloud.app.guggu.NavigationDrawerFragment.onCreateView(NavigationDrawerFragment.java:75)
at android.app.Fragment.performCreateView(Fragment.java:1700)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:866)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1040)
at android.app.FragmentManagerImpl.addFragment(FragmentManager.java:1142)
at android.app.Activity.onCreateView(Activity.java:4803)
我已经添加了下面的代码,但是我仍然得到这个异常-
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
mDrawerList.setLayoutManager(layoutManager);
如果我删除了回收站 View 中的内容,那么也不异常(exception)。
最佳答案
从布局文件中的 RecyclerView
中删除子元素。我不知道那些应该是什么,但它们不应该是 RecyclerView
的子项。
关于android - java.lang.IllegalStateException : RecyclerView has no LayoutManager 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30123080/