Androidx TabLayout in Sketchware

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) tabLayout = new;
// Make TabLayout 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("Friday"));
// Add TabLayout to AppBarLayout
// Set text of textview1
// Add OnTabSelectedListener to the TabLayout
public void onTabSelected( tab){
textview1.setText(tab.getText().toString()); }
public void onTabReselected( tab){ }
public void onTabUnselected( tab){ }

4. Save and run the project.


  1. Hi Sanjeev, Just need a small help. In the latest update in sketchware i am unable to upload the pic to Firbase storage can u please help me to reslove it.


Post a Comment

Popular posts from this blog

Create Music Player app in Sketchware

A Flash Light App in Sketchware

Admob rewarded video Ads in Sketchware

Simple car racing android game in Sketchware

Firebase auth in Sketchware for Login Activity