Recycler View 未在三星 S8 中显示项目

Recycler View not showing item in Samsung S8

我在滚动视图中使用 recyclerViewGridLayoutManager。项目正在适配器中膨胀,但未显示在视图中。此特定问题仅在 Samsung S8 中存在。休息所有设备都正常显示它。

    val layoutManager = GridLayoutManager(activity, 2)
    layoutManager.orientation = GridLayoutManager.VERTICAL

    val recyclerView = rvDropDownVideos
    val videoThumbnailAdapter = VideoThumbnailAdapter(activity, this, 
    videoList, videoUrlList, videoTitleList)

    recyclerView.layoutManager = layoutManager
    recyclerView.isNestedScrollingEnabled = false
    recyclerView.adapter = videoThumbnailAdapter

而XML代码是

    <android.support.v7.widget.RecyclerView
            android:id="@+id/rvDropDownVideos"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:background="@drawable/rounded_corners_bottom"
            android:padding="@dimen/dp_10" />

任何人都可以告诉我为什么在 S8 中存在视图问题。

尝试使用这个

 VideoThumbnailAdapter videoThumbnial = new VideoThumbnailAdapter(activity, this, 
        videoList, videoUrlList, videoTitleList);
                recyclerView.setHasFixedSize(true);
                recyclerView.setLayoutManager(new GridLayoutManager(activity),2));
                recyclerView.setAdapter(videoThumbnial);

尝试这种方式 java 代码并删除所有额外的属性,如果你不使用像 isNestedScrollingEnabled 并且还删除 xml 代码 android:layout_gravity 因为你给 match_parent和 match_parent.

recyclerView.setLayoutManager(new GridLayoutManager(this,2,LinearLayoutManager.VERTICAL,false));

recyclerView.setAdapter(videoThumbnailAdapter)
       videoThumbnailAdapter.notifyDataSetChanged();

使用 NestedScrollView 而不是 ScrollView