Home / Videos / BottomNavigationView mit Fragmenten – Android Studio Tutorial

BottomNavigationView mit Fragmenten – Android Studio Tutorial

In diesem Video erfahren Sie, wie Sie Ihrer Aktivität eine untere Navigation hinzufügen und zwischen verschiedenen Fragmenten wechseln. Wir füllen unsere BottomNavigationView mit 3 Menüelementen und überprüfen, welches Element mit der OnNavigationItemSelectedListener-Schnittstelle und einer switch-Anweisung ausgewählt wurde. Anschließend erstellen wir das entsprechende Fragment und zeigen es mithilfe der Methoden getSupportFragmentManager, beginTransaction und replace in einem FrameLayout an.

Beispielcode + Abhängigkeit:

❗ Abonniere den Kanal:

⏯ Weitere Tutorials ansehen:

⭐ Werden Sie Channel-Mitglied für exklusive Tutorials und andere Vorteile:

㊙ Hilf beim Übersetzen der Videos:

💚 Unterstützen Sie den Inhalt:

💬 Am Discord-Chat teilnehmen:

🎧 Hörbücher und Podcasts für Programmierer:

👶 So fangen Sie mit der Android-Entwicklung an:

📣 Folgen Sie Coding in Flow in den sozialen Medien:





About AndroidWeltEditor

Check Also

181 Abhayam Women Helpline || Android Mobile Apps || Allgemeinwissen || aktuelle Angelegenheiten || Nachrichten

181 Abhayam Women Helpline || Android Mobile Apps || Allgemeinwissen || aktuelle Angelegenheiten || News, …


    If your project is using AndroidX dependencies, add this new dependency instead of the design support library: implementation 'com.google.android.material:material:1.1.0'
    If you want to keep the selected fragment when rotating the device, make the following little change to the code:

    Surround the fragment transaction in the onCreate method with an if/else statement like this (I also changed the code on my website):

    if (savedInstanceState == null) {
    new HomeFragment()).commit();

  2. How to find buttons or items from MainActivity please help

  3. hey, how can i run code in a fragment?

  4. Wow! Straightforward to the point! Congratulations! Very very good tutorial!

  5. Dependencies
    Error:Failed to resolve:androidx.appcompat:design:1.1.0

    Please Hlp me Sir…!!!!

  6. Hi, thanks a lot, really helped

    I just have a question, how can you override the pending transition between the fragments?… I've tried the usual instruction but it doesn't work. Thanks again.

  7. hi really super your explaination… i quickly grasp your class.. and your voice is super and nice to hear…thank u

  8. why layouts inside fragment_container not replace?

  9. How to integrate bottom and sidebar navigation??

  10. The following classes could not be instantiated:

    – com.google.android.material.bottomnavigation.BottomNavigationView

  11. i am new to android development and this tutorial was super helpful!
    thank you!

  12. implementation 'com.android.support:appcompat-v7:28.0.0-rc01'

  13. is there an easy way to figure out what in the world we have to implement depending on the version we are using? I don't know why I am having problems with this, I can't find a simple straight up answer on google or developer.android.com seems like the answer should be clear. I have tried so many implementations and they are wrong.

  14. I used your code in my project like how you done. But the problem is when I start clicking from 4th tab to any other tab anonymously the bottom navigation bar gets pushed down.

  15. I'm having a problem when i switch from fragment to fragment, I have button which is set to invisible when pressed and when ever I switch from that fragment to another and then return to original fragment its no longer invisible. is there anyway to saveInstanceState between fragments?

  16. Very good tutorial Coding in Flow. Thank you very much!

  17. You make it look easy brother.

    Thank you

  18. I can't find android.supprt.v4.app.Fragment

  19. Is it possible to change the background color of particular selected tab?

  20. in case you want an animation effect between fragments transition yo can do something like this:

    getSupportFragmentManager().beginTransaction().setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out).replace(R.id.container, selectedFragment).commit();

  21. getting an error saying selectedFragment unreachable in the mainActivity

  22. Thank you very much sir use full on video…. easy to understand…. sir

  23. Any update for androidx Fragment?

  24. Hello, I am having trouble adding the bottom navigation view.
    I know this is not stack exchange, lol, but here is what im doing and my fragment wont show up.
    I would greatly appreciate your help!

     <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"




  25. Great but how to make it swipeable sir?

  26. How does one do this in Kotlin?

Leave a Reply

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