Androidx ViewPager in Sketchware
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7Xe4sLFgLi51dtexKGmTkRgnyuKORAgu2PDLM8wyDYyhnM48KasXRoax280Ly9qrCK6T41fbdw6Ht227vGXmfbJeHFDtzK5Xo2C-Yt6yzQ8X5jTKtG9OK_4fs079OisXBeEdFQKRp9gOo/s320/Screenshot_2020-02-25-21-55-38-425_com.my.tablayout.jpg)
The example provided below shows how to create a simple ViewPager with four pages in Sketchware. 1. In VIEW area of main.xml add a LinearV linear1 with width and height as match_parent. Set it's padding to 0. ViewPager will be created programmatically and added to linear1 . 2. Switch On AppCompat and design. 3. Add four CustomViews page0.xml , page1.xml , page2.xml , and page3.xml . These will act as the pages of the ViewPager. In page0.xml add a TextView textview1. In page1.xml add a TextView textview1. In page2.xml add a Button button1. In page3.xml add a TextView textview1. 4. Create a more block extra and define the block using an add source directly block. Put following code in the add source directly block. } // Create a list of pages int[] pageId = { R.layout.page0, R.layout.page1, R.layout.page2, R.layout.page3 }; // Define PagerAdapter for ViewPager private class MyPagerAdapter extends androidx.viewpager.widget.Pa