Javatpoint Logo
Javatpoint Logo

Android TabLayout with FrameLayout

In the previous page, we created a sliding tabs using TabLayout and ViewPager. Here, we are going to create non sliding tabs using TabLayout and FrameLayout.

Items of TabLayout are implemented by adding TabItem of android support design widget.

Example of TabLayout using FrameLayout

Let's create an example of TabLayout using FrameLayout and Fragment.

File: activity.xml

Create an activity.xml file with TabLayout and FrameLayout view components.

File: build.gradle

Now gave the dependency library of TabLayout in build.gradle file.


Now create different fragment files for all different tabs.


File: fragment_home.xml


File: fragment_java.xml


File: fragment_android.xml


File: fragment_php.xml

File: strings.xml


android tablayoutwithframelayout1 1
android tablayoutwithframelayout1 2
Next TopicAndroid SearchView

Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA