Create and Design a TabLayout with Fragments Android studio tutorial



It’s been a long time since I uploaded a new video. I’m very sorry about that. It was really hard for me to find the time to make this tutorial. I hope you are all doing well and I wish a happy new year for everyone 🙂
In this video I will show you how to design and create a tablayout with fragments!
In this part I will show you how to design the light theme version of the tablayout in the second part we will design the dark one and maybe we will add icons to the tab. stay tuned!
if you enjoyed and learned something from my tutorials Please subscribe and like this video

————————————————————————-
Follow me On :
Google Plus :
Instagram :
Github :
My blog :
————————————————————————–
Music Credits:
chill day by LAKEY INSPIRED
music link :

44 Replies to “Create and Design a TabLayout with Fragments Android studio tutorial”

  1. Abedin Zhuniqi

    Thanks for the video man for me it is working but I was wondering it is possible when the app is open the second tab is selected not the first or the third ?

  2. WarNinGXK

    I get JUST this error in ViewPagerAdapter:

    getItem(int) in "my app name" clashes with getItem(int) in "android.support.v4.app.FragmentPagerAdapter";

    And if i write public android.support.v4.app.Fragment instead of just "public Fragment…" i get this ass error: (see image please) https://prnt.sc/lcyq7p

  3. My SysD

    Thank you sir for this video.
    A question: is-it possible to use the class ViewPagerAdapter for several tabbed Activities in the same app only by changing for each activity the too ArrayList of the fragments and the titles? I try but i don't succeed. Thank you.

  4. Devesh Kumar

    viewPagerAdapter.AddFragment(new IPDpatientFragment(),"IPD Patient");
    when i use this it is showing an error in(new IPDpatientFragment()).
    Error is :– Wrong 1st argument type. Found: 'com.example.mrjitesh.feedo.IPDpatientFragment', required: 'android.support.v4.app.Fragment.
    can you please tell me solution of this.

  5. Shivam Bulsara

    @Aws Rh Thanks ! It worked for me !

    Hey guys ! If you want to have icons for you TabLayout, then what you can do is create an int[ ] array of drawables in your MainActivity onCreate method.

    For example :

    TabLayout myTabLayout = findViewById(R.id.my_tab_layout);

    int[ ] tabIcons = { R.drawable.tab_1_icon , R.drawable.tab_2_icon , R.drawable.tab_3_icon };

    myTabLayout.getTabAt(0).setIcon(tabIcons[0]);
    myTabLayout.getTabAt(1).setIcon(tabIcons[1]);
    myTabLayout.getTabAt(2).setIcon(tabIcons[2]);

    Hope it helpful to you !

Leave a Reply

Your email address will not be published. Required fields are marked *