RecyclerView has no LayoutManager

RecyclerView has no LayoutManager android.support.v7.widget.RecyclerView

问题

Caused by: java.lang.IllegalStateException: RecyclerView has no LayoutManager
        android.support.v7.widget.RecyclerView
        {c54e9e8 VFED..... ......I. 0,0-0,0 #7f080087 app:id/recycler_view}, 
        adapter:null, 
        layout:null, 
        context:com.peter.myapplication.MainActivity@9e94891
        at android.support.v7.widget.RecyclerView.generateLayoutParams(RecyclerView.java:4304)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
        at com.peter.myapplication.MainActivity.onCreate(MainActivity.java:39) 
        at android.app.Activity.performCreate(Activity.java:6237) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:5417) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

解决

Remove the child elements from RecyclerView in your layout file. I don't know what those are supposed to be, but they are not supposed to be children of the RecyclerView.
删除RecyclerView布局文件中所有的子元素.



        
                
                
                

你可能感兴趣的:(RecyclerView has no LayoutManager)