android fragment中使用viewpager报空指针,vpBanner 这里就是空了
伊谢尔伦
伊谢尔伦 2017-04-17 16:53:16
0
3
576
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
小葫芦

vpBanner is initialized in Fragment and uses rootView to findView

Peter_Zhu

You can put this initView and initDot into fragment.

巴扎黑

vpBanner = (ViewPager) findViewById(R.id.vpBanner); This assignment means to find the control with the id vpBanner in the current activity layout. This control does not exist in your activity_main.xml. You should load the fragment_main.xml layout first,
fragmentView = getLayoutInflater().inflate(R.layout.more_view,null); then
vpBanner = (ViewPager) fragmentView.findViewById(R.id.vpBanner);

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template