How to fix 'android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5035)' error in android

我的未来我决定 提交于 2019-12-03 09:19:22
Dmitry Nelepov

Problem solved!

It's happened because I call LayoutInflater.inflate([subViewOfViewPager], [ParentOfViewPager])

it should be:

LayoutInflater.inflate([subViewOfViewPager], [ParentOfViewPager], false))

More words:

It's happened because when called inflate with second parameter, view inserting as subchild of given ViewGroup, and then I try add this View to ViewPager. View can have only one Parent ViewGroup element. The third parameter sets attachToRoot to false to avoid this.

Simplified version of answer

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.cab_listing, container,false);
    return view;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!