Posts

Showing posts with the label TabLayout in Sketchware

Androidx TabLayout in Sketchware

Image
This example provided below shows how to create a simple scrollable TabLayout and add a TabLayout.OnTabSelectedListener to it in Sketchware. 1. In VIEW area of main.xml add a TextView textview1. 2. Switch On AppCompat and design. 3. In  onCreate  event, use an add source directly block and put following codes. // Create a TabLayout (tabLayout) com.google.android.material.tabs.TabLayout tabLayout = new com.google.android.material.tabs.TabLayout(this); // Make TabLayout scrollable tabLayout.setTabMode(com.google.android.material.tabs.TabLayout.MODE_SCROLLABLE); // Add Tabs to the TabLayout tabLayout.addTab(tabLayout.newTab().setText("Sunday")); tabLayout.addTab(tabLayout.newTab().setText("Monday")); tabLayout.addTab(tabLayout.newTab().setText("Tuesday")); tabLayout.addTab(tabLayout.newTab().setText("Wednesday")); tabLayout.addTab(tabLayout.newTab().setText("Thursday")); tabLayout.addTab(tabLayout.newTab().setText("F...