小编Dio*_*usa的帖子

W/Choreographer:OPTS_INPUT:第一帧是在优化之前绘制的,所以跳过

所以我创建了一个 recyclerview 并将其设置为默认(垂直)并且它工作正常,加载我放置的 8/8 图像。但问题是,当我将方向更改为(水平)时,它仅加载 2/8 图像并输出错误/警告 W/Choreographer:OPTS_INPUT:第一帧是在优化之前绘制的,所以跳过!

在 RecyclerViewAdapter 中我使用 Glide 来加载图像

Glide.with(mContext)
                .asBitmap()
                .load(mImage.get(position))
                .into(holder.image);
Run Code Online (Sandbox Code Playgroud)

在片段中

它适用于垂直方向

recyclerView.setLayoutManager(new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false));
Run Code Online (Sandbox Code Playgroud)

但是当我改变方向时

recyclerView.setLayoutManager(new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false));
Run Code Online (Sandbox Code Playgroud)

它只加载 2/8 图像

这是 Home_Fragment 的代码

public class HomeFragment extends Fragment {

private static final String TAG = "HomeFragment";

//Vars
private ArrayList<String> mImage = new ArrayList<>();
private ArrayList<String> mTitle = new ArrayList<>();
private ArrayList<String> mDesc = new ArrayList<>();

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    // initialize container view …
Run Code Online (Sandbox Code Playgroud)

java android android-recyclerview

5
推荐指数
0
解决办法
2128
查看次数

标签 统计

android ×1

android-recyclerview ×1

java ×1