今天有个需求,要用ViewPager加载自定义布局

具体是在ViewPager的apdater(继承自PagerAdapter)里面操作:

在instantiateItem方法里:

ViewPager加载自定义布局

 View view = LayoutInflater.from(mContext).inflate(R.layout.item_layout_course_outline,container,false);//这里传的false,如果不传这个参数,会报错“viewpager java.lang.IllegalStateException: The specified child already has a parent”

 

相关文章:

  • 2022-02-07
  • 2021-12-19
  • 2022-02-04
  • 2021-05-31
  • 2022-12-23
  • 2021-11-18
  • 2021-07-12
  • 2019-06-22
猜你喜欢
  • 2021-08-21
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
  • 2018-05-03
  • 2021-04-04
相关资源
相似解决方案