1.用法
1>.初始化ViewPager的數(shù)據(jù)

Screen Shot 2020-04-18 at 12.46.40 AM.png

Screen Shot 2020-04-18 at 12.51.54 AM.png
2>.創(chuàng)建PagerAdapter實現(xiàn)其四個方法

Screen Shot 2020-04-18 at 12.52.21 AM.png
注意LinerLayout是一個ViewGroup,在其里面添加元素應(yīng)該是這樣的

Screen Shot 2020-04-18 at 1.08.29 AM.png
2.另外ViewPager還有4個監(jiān)聽的方法

Screen Shot 2020-04-18 at 1.07.05 AM.png
3.ViewPager里面是Fragment

Screen Shot 2020-04-18 at 1.16.53 AM.png