In this video tutorial#05 we will create tab layout with different fragments and we will design it. We will access the android fragments with viewpager.
So in this video tutorial you will learn about android fragments with tabs and viewpager and we will set title for android fragments with tabs and viewpager.
you will learn how to use fragments with tabs android and fragments with viewpager in android studio and also you will learn how to set title for fragments in android studio.

Nguồn:https://u-os.org/

Author

47 Comments

  1. Coding Cafe Reply

    Link to complete Source Code upto 58 Tutorials: https://drive.google.com/open?id=1GvalJLBpSw5Dc_AACi_-OSWpmGO6VcKH

    Importent Notice:
    Make sure to check and compare your "AndroidManifext.xml" lines of code for "Intent Filter". Also do check the dependencies version.
    If anyone is new to android development then please replace & use the same versions for the dependencies.

  2. Nish Uzumaki Reply

    Hi for the activity_main.xml …
    when i try to copy paste the include code inside the <android.support.design.widget.AppBarLayout….
    the <include> tag becomes highlighted in yellow, but i cant figure out the error for it. So i completed the whole code but when i run the program, the app keeps crashing and does not want to open in the virtual machine, im not sure what is the error

  3. Shaziya Khan Reply

    Dependency ka kha se copy kre … write krne pr error aa rha h

  4. sir design dependency not fixed in androidx .i wirte in android after migrate to androidx .now what i do to fix it

  5. i think u should use this if u are newly install androix implementation 'com.google.android.material:material:1.1.0'

  6. Jehanzeb ali Reply

    Sir error occur in implementation of design dependency but if i write
    "implementation 'com.google.android.material:material:1.0.0'"
    no error occur but i cant get the tag of design in xml file.. help me plz sir

  7. بلال المومني Reply

    Hello, I tried to find a solution to this problem, but unfortunately
    myTabLayout.setupWithViewPager(myViewPager);

    ———————————-
    (setupWithViewPager)
    ———————————

    I called a lot of offices and the problem was not remedied

    implementation 'androidx.viewpager:viewpager:1.0.0'

    implementation 'androidx.viewpager2:viewpager2:1.0.0'

    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.fragment:fragment-ktx:1.2.0'

    implementation 'com.google.android.material:material:1.2.0-alpha03'

  8. Somith Singha Reply

    can we do the same in androidx since our android studio is updates

  9. i am struck . my android studio only have androidx . not having android.support.v7. anyone helpme

  10. Just for you, indians:

    private Toolbar mToolbar;

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mToolbar = (Toolbar) findViewById(R.id.main_page_toolbar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setTitle("Sportify Your Life!");
    }

  11. ruchi priya Reply

    After clicking run, it is showing no usb device or running emulator detected, can someone help me with this

  12. HASIBULLAH MAHMOOD Reply

    use
    implementation 'com.google.android.material:material:1.0.0-rc01'
    for design

  13. implementation 'com.android.support:design:28.0.0'
    Is not working for me, its not showing up when typing, I have the latest Android Studio, with androidx.
    It changed to implementation 'com.google.android.material:material:1.0.0'
    Thank you

  14. ali bhai, oregional whatsapp ma update k bad fragments view change hua ha, os ma ab 4 fragments hen new fragment ma camera add hua ha plz zara is per 1 new video banaen k 4th fragment kasy banaen q k oska size bhi baqi fragment sy chota ha or 2nd ye k jab other fragment sy camera fragment ki taraf jaen to tab layout bhi oper ki janib close hota ha plz is per 1 video bana den

  15. I'm getting an error lyk Main@318476d must implement OnFragmentInteractionListener

  16. l am getting an error: ERROR: Failed to resolve: androidx.support:design:1.1.0-rc01

  17. Find android.support.design.widget.AppBarLayout and replace it with com.google.android.material.appbar.AppBarLayout

  18. Minne Reijnders Reply

    My App crashed aswell but i found the solution. It had to do with the 'android.appcompat:design:1.0.2' implementation. This doesn't work if you use AndroidX*. If you do so instead use the *implementation 'com.google.android.material:material:1.0.0-rc01' witch gives you the same funtions. But to adapt to this implementation you will also have to change the Layout declaration in activity_main.xml to com.google.android.material.appbar.AppBarLayout for the AppBarLayout
    and to com.google.android.material.tabs.TabLayout for the TabLayout

  19. waqar younas Reply

    not work files & not show any type of error . only first time worked in testing app and now not show new steps in app testing only first view showing every time

  20. Your corner Reply

    Error in linking resource files .of fragments. What should I do now it's been two days and i didn't find any solution for that

  21. Sharanya Mekala Reply

    implementation 'androidx.appcompat:appcompat:1.0.2'

    for this what we have to do sir

  22. ShivShankar Upadhyaya Reply

    Sir app stop ho rha hai baar baar please give some solutions

  23. If you have an error like " must implement OnFragmentInteractionListener", remove a line "throw RuntimeException(context.toString() + " must implement OnFragmentInteractionListener")" in each fragment class

  24. rupa prajapati Reply

    Hello friend if your app stop automatically then in main activity implement chatfragment.OnfragmentIntractionListener,Groupsfragment.OnfragmeIntractionListener,Contactsfragment.OnfragmentationListener then run your problem will be solve

  25. My app was crashing aswell,
    I fixed it by :
    Changing the code in values/style.xml file
    I changed the parent to Theme.AppCompat.Light.NoActionBar
    Before it was something like Base.Theme….

  26. Nuwan Malintha Reply

    You have forgotten to change the return value of getCount method

    public int getCount() {
    return 3;
    }

  27. Vivek Yadav Reply

    I have no idea how you did all of that. Is it possible to achieve the same via the design view?

  28. developer s Reply

    please attach the source code link in description of every video on github

  29. Double negatives Reply

    for people whom their app is crushing here is the solution : go to activity_main.xml and look this video @3:18 compare your code to his, </android.support.design.widget.TabLayout>
    </android.support.design.widget.AppBarLayout>
    must close before
    <android.support.v4.view.ViewPager

  30. verma sachin Reply

    After running it's showing application stopped.. Sir what to do

  31. Brilliant- 1 Reply

    brother your tutorial was good I was able to do everything right. However when the app opens the Tab layout doesn't display the "Chats", "Groups", and "Contacts" titles. Please help me on that.

Write A Comment