recyclerview没有附加适配器;跳绳布局

问题描述:

刚刚实施Recyclerview在我的code,取代列表视图。

just implemented Recyclerview in my code, replacing Listview.

一切工作正常。的对象被显示。

everything works fine. The objects are displayed.

但logcat的说

15:25:53.476 E / RecyclerView:无适配器连接;跳绳布局

15:25:53.476 E/RecyclerView﹕ No adapter attached; skipping layout

15:25:53.655 E / RecyclerView:无适配器连接;跳绳布局

15:25:53.655 E/RecyclerView﹕ No adapter attached; skipping layout

为code

ArtistArrayAdapter adapter = new ArtistArrayAdapter(this, artists);
recyclerView = (RecyclerView) findViewById(R.id.cardList);
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);``
recyclerView.setLayoutManager(new LinearLayoutManager(this));

你可以看到我重视的recycleview适配器。 那就是为什么我不断收到这个错误?

as you can see I have attached an adapter for recycleview. so why do i keep getting this error?

我已经阅读相关的同样的问题,其他的问题,但没有任何帮助。

i have read other questions related to same problem but none helps.

你能确保你在呼唤从主线程这些语句(例如onCreate方法里面)。 当我称之为从延迟方法相同的语句。在我的情况下,ResultCallback,我得到了同样的信息。

Can you make sure that you are calling these statements from the "main" thread (for example inside the onCreate method). As soon as I call the same statements from a "delayed" method. In my case a ResultCallback, I get the same message.

在我的片段,从里面ResultCallback方法调用低于code产生了同样的信息。移动code到onConnected方法中我的应用程序后,该消息已经走了......

In my fragment, calling the code below from inside a ResultCallback method produces the same message. After moving the code to the onConnected method within my app, the message was gone...

LinearLayoutManager llm = new LinearLayoutManager(this);
llm.setOrientation(LinearLayoutManager.VERTICAL);
list.setLayoutManager(llm);
list.setAdapter( adapter );