In this video you will learn, how to add a bottom navigation to your activity and use it to switch between different fragments. We will fill our BottomNavigationView …
Nguồn:https://u-os.org/
Xem thêm Bài Viết:
- Hướng dẫn cách lắp anten ngoài trời đúng kỹ thuật, thu sóng khỏe nhất
- Giải đáp bí ẩn Xamarin là gì? Ưu và nhược điểm khi sử dụng Xamarin
- Tuyệt chiêu sửa lỗi window photo viewer can’t open this picture because
- Bộ nhớ đệm là gì? Có nên xóa bộ nhớ đệm trên thiết bị không?
- Bật mí 3 cách chụp ảnh bằng máy tính win 7 dễ như ăn kẹo
22 Comments
DEPENDENCY UPDATE:
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) {
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
new HomeFragment()).commit();
}
Brilliant tutorial, helped me a lot thanks! 😀
Sir, could you please explain how to add buttons on viewmodel class?
why it's not working for me on existing project ?
It is amazing
I cant find any bottomNavigationView Widget what should I do
Great Video!!!, very good guiding, explaining and showing, I have a question, do you know how to prevent fragments to refresh on tab changing ? I haven't seen a good tutorial for it, whatever I find online does not work or doesn't explain thoroughly. Thanks in advance.
How to find buttons or items from MainActivity please help
hey, how can i run code in a fragment?
Wow! Straightforward to the point! Congratulations! Very very good tutorial!
Dependencies
Error:Failed to resolve:androidx.appcompat:design:1.1.0
Please Hlp me Sir…!!!!
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.
hi really super your explaination… i quickly grasp your class.. and your voice is super and nice to hear…thank u
EXCELLENT
why layouts inside fragment_container not replace?
How to integrate bottom and sidebar navigation??
The following classes could not be instantiated:
– com.google.android.material.bottomnavigation.BottomNavigationView
i am new to android development and this tutorial was super helpful!
thank you!
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
thank you very much teacher
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.
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.