Android RecyclerView没有';我没有出现

Android RecyclerView没有';我没有出现,android,android-fragments,android-recyclerview,picasso,mvp,Android,Android Fragments,Android Recyclerview,Picasso,Mvp,我遇到了一个问题,我的RecyclerView从服务器端获取数据后没有出现。 当我试图调试我的代码时——有时它转到DataAdapter类——有时不是。不幸的是,我不明白为什么会这样 我使用的是MVP模式,可能我将数据设置为适配器错误 我会试着把代码放在这里,并解释我在做什么 首先,我的卡视图xml文件: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:a

我遇到了一个问题,我的RecyclerView从服务器端获取数据后没有出现。 当我试图调试我的代码时——有时它转到DataAdapter类——有时不是。不幸的是,我不明白为什么会这样

我使用的是MVP模式,可能我将数据设置为适配器错误

我会试着把代码放在这里,并解释我在做什么

首先,我的卡视图xml文件:

<?xml version="1.0" encoding="utf-8"?>

<android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/card_view"
    android:layout_width="match_parent"
    android:layout_height="200dp"
    android:layout_margin="5dp"
    card_view:cardCornerRadius="4dp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">

        <ImageView android:id="@+id/info_image"
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:layout_weight="1.0"
            android:scaleType="centerCrop"/>

        <TextView
            android:id="@+id/info_text"
            android:layout_marginLeft="5dp"
            android:layout_marginBottom="5dp"
            android:layout_height="wrap_content"
            android:layout_width="match_parent"/>
    </LinearLayout>
</android.support.v7.widget.CardView>
另外,当我尝试使用“回收者”视图打开活动时,它没有显示我有下一个日志:

W/EGL_emulation: eglSurfaceAttrib not implemented
W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xe1b01280, error=EGL_SUCCESS
D/OpenGLRenderer: endAllStagingAnimators on 0xeb8d2e80 (RippleDrawable) with handle 0xe1b2dab0
当我使用recycler视图重新打开活动时,它显示-我有下一个日志:

W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/OpenGLRenderer: endAllStagingAnimators on 0xeb8d2e80 (RippleDrawable) with handle 0xe25165b0
A/libc: Fatal signal 4 (SIGILL), code 2, fault addr 0xf6f1d46e in tid 2539 (16/6gMRtQyY.jpg)
然后应用程序崩溃


检查我的答案。

尝试返回正确的片段根视图组,而不是小部件视图

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
View  view = inflater.inflate(R.layout.fragment_recycler_view, container, false);
        RecyclerView recyclerView = (RecyclerView)view.findViewById(R.id.recyclerView);
        dataAdapter = new DataAdapter(getActivity());
        recyclerView.setAdapter(dataAdapter);
        LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
        recyclerView.setLayoutManager(layoutManager);
        return view;
    }

编辑:我添加了
dataAdapter.notifyDataSetChanged()适配器获取数据所在的行

@Override
        public void setAutoServiceListOnAdapter(AutoService[] autoServices) {
            dataAdapter.setAutoServices(autoServices);
            dataAdapter.notifyDataSetChanged();
        }

提供错误日志。这不是我们需要回答的问题,它仍然没有帮助(当我的回收器视图没有显示时,我没有收到任何错误(我甚至不能提供更多的日志信息)(@Andrew无论如何要这样做。你提供的代码是完全错误的)
W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/OpenGLRenderer: endAllStagingAnimators on 0xeb8d2e80 (RippleDrawable) with handle 0xe25165b0
A/libc: Fatal signal 4 (SIGILL), code 2, fault addr 0xf6f1d46e in tid 2539 (16/6gMRtQyY.jpg)
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
View  view = inflater.inflate(R.layout.fragment_recycler_view, container, false);
        RecyclerView recyclerView = (RecyclerView)view.findViewById(R.id.recyclerView);
        dataAdapter = new DataAdapter(getActivity());
        recyclerView.setAdapter(dataAdapter);
        LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
        recyclerView.setLayoutManager(layoutManager);
        return view;
    }
@Override
        public void setAutoServiceListOnAdapter(AutoService[] autoServices) {
            dataAdapter.setAutoServices(autoServices);
            dataAdapter.notifyDataSetChanged();
        }