lixplor / android-Q-A

🐞 android related questions and answers
0 stars 0 forks source link

ViewPager setAdapter时StackOverFlow #70

Closed lixplor closed 7 years ago

lixplor commented 7 years ago

ViewPager setAdapter时StackOverFlow

lixplor commented 7 years ago

原因: 可能是ViewPager的PagerAdapter中instantiateItem()方法中inflate了布局, 在inflate时不要传入container 解决: View view = View.inflate(container.getContext(), R.layout.page_list, null);