我在ViewPager中使用了RecyclerView。在RecyclerView中设置GridLayout管理器。 问题是ViewPager不能平滑滚动。
我已经完成了以下操作:
override fun instantiateItem(parent: ViewGroup, position: Int): Any {
val view = LayoutInflater.from(parent?.context)
.inflate(R.layout.item_reciepe_adapter, parent, false)
val recyclerIngredients: RecyclerView = view.findViewById(R.id.recycler_ingredients)
recyclerIngredients.layoutManager = GridLayoutManager(mContext, 3)
ingredientsAdapter = IngredientsAdapter(mContext)
recyclerIngredients.adapter = ingredientsAdapter
recyclerIngredients.visibility = View.VISIBLE
// Get the widgets reference from layout
// Add the view to the parent
parent?.addView(view)
// Return the view
return view
}
可能是什么解决方法?