This is easier to absorb than the official Android documentation. You rock!
@manishpingale65584 жыл бұрын
I genuinely think that you explain very very easily ,I watched your some videos from newbie to pro series and they were AWESOME like I was having problem in KOTLIN LAMBDA FUNCTION but I understood after watching it THANK YOUUUUUU
@jayceeddeyro14064 жыл бұрын
I want to use fragments with different layout for each tab? do you have a tutorial for that?
@hellosagar4 жыл бұрын
use tab layout with fragment
@RodrigoGTomaz4 жыл бұрын
Hi Philipp, Thank you for your very helpful videos! As far as your problem with the Viewpager overlapping the TabLayout when using ConstraintLayout, that can be fixed by setting the layout_heigh of the Viewpager to 0dp instead of match_parent.
@PhilippLackner4 жыл бұрын
Thanks for the info!
@TheImaginativeSachin2 жыл бұрын
can we apply this behaviour of tabs and view pagers to like bottom nav buttons and fragments. With like the attach( ) ?
@d2words4 жыл бұрын
Very useful tutorial, I wonder what should we do if we want to replace a fragment on the fly?
@gstarentertainmentedits24152 жыл бұрын
Thanks bro 👌🙏
@ricardoestrella954 жыл бұрын
Hi Philipp, awesome videos. How can I pass multiple linearLayourts to each page in the adapter?
@codeexplorer42123 жыл бұрын
Nice video. But whenever I am trying to browse any gallery of images horizontally in webview, the viewpager is landing on another view. Any suggestions?
@alicenyw18722 жыл бұрын
For those who have TabLayoutMediator properties in red, it's because it wants you to use binding. Philipp shows how to set it up in one of his videos. Depending on what Id's you gave, your code should look something like this: TabLayoutMediator(binding.tabLayout, binding.viewPager,) { tab, position -> tab.text = "Tab ${position + 1}" }.attach()
@rotimidokun Жыл бұрын
Thanks Alice. This was helpful
@dharamveergupta35714 жыл бұрын
How to make selected color for both text and icon of tab, other which aren't selected as greyed
@AlgeriaHere4 жыл бұрын
very helpful video thank you , but just one question in the viewpageradapter , should we extend it from FragmenntStateAdapter and if yes please what did you pass as an argument for the constructor cause i m looking up for solution , didnt find any , thank you
@PhilippLackner4 жыл бұрын
Thanks! The viewpager2 uses a normal recyclerview adapter. If you use viewpager1 then you can use the FragmentStateAdapter
@AlgeriaHere4 жыл бұрын
in my case i'm using viewpager2 , so i need to make a class that recyclerview adapter, and another little question if you dont mind , i m usin third party library called smarttablayout , is there way to pass that in tablayoutmediator because apparently it only takes the normal tablayout thank you
@PhilippLackner4 жыл бұрын
So I don't know that library, but if that custom tablayout is a subclass of tablayout then it should actually work to pass it to the mediator
@AlgeriaHere4 жыл бұрын
it is actually a library and when i passed it , it said require tablayout , and mine is smarttablayout
@PhilippLackner4 жыл бұрын
Then it might be an older library that doesn't work with the new viewpager2. Then you need to use it with viewpager1 and create a fragmentstateadapter
@mehulbisht97084 жыл бұрын
if there are fragments that are hosted by the viewpager and you are getting data in those fragments from firebase then the first ( or default ) fragment of the layout has a bug that doesn't show the data because data wasn't loaded when the fragment was added to the viewpager. However the fragments after the first work as expected. What could be this bug ? For sure i know that data retrieved isn't null since i tried to add the same data to second fragment and it worked . it's just the timing .
@Js-ig6jz4 жыл бұрын
Hello, your videos are quite good. I have a question about how I can customize a CalendarView so I can add events
@mohammadjeeshan42864 жыл бұрын
Can you explain what is the difference between tabhost and tab layout in Android
@nonelelacele93002 жыл бұрын
I've implemented something similar to this, but I have Icons on the tab Items. The tabs are always behind the app bar
@guy14074 жыл бұрын
Thanks for the demo. I am not sure I would show this demo with tabs (not very useful), maybe another sample , tabs are used in many apps today
@masoudkhedernezhad28103 жыл бұрын
in API 31 i cant do it... in this code TabLayoutMediator(tabLayout , ViewPager) {tab , position -> tab.text = "Tab ${position + 1}" }.attach() tabLayout in () get red and android studio says that i have to create a fun... help me pls
@nevresam.8262 жыл бұрын
I have the same problem ... please help, how can we solve this?
@rowenarrow2 жыл бұрын
Make sure you are using in activity_main.xml
@sujalaggrawal5481 Жыл бұрын
Try This instead! val adapter = ViewPagerAdapter(images) findViewById(R.id.viewPager).adapter = adapter TabLayoutMediator(findViewById(R.id.tabLayout),findViewById(R.id.viewPager)){ tab , position -> tab.text = "Tab ${position+1}" }.attach()
@chirantanchaudhury28093 жыл бұрын
thank you very helpful
@daiyrkanybekov85754 жыл бұрын
You are amazing broo
@PhilippLackner4 жыл бұрын
Thanks you too :)
@valarmorghulisx4 жыл бұрын
Thank you so much! i tried it. but i have little problem. when i try to show toast message which are mixing. android studio is showing in same time. how can i solve it?
@PhilippLackner4 жыл бұрын
You mean you want to show two toasts one after another?
@valarmorghulisx4 жыл бұрын
@@PhilippLackner No No, i just tried your code same. But when i clicked one tab after the another tab. it tried to show multi toast in same time. for example it shows "Unselected tab2" and "Selected tab1" so they are mixing.
@PhilippLackner4 жыл бұрын
@@valarmorghulisx yes that can happen when you show them at the same time. In production you should of course avoid this, I just wanted to show how the different events work here 👍
@valarmorghulisx4 жыл бұрын
@@PhilippLackner ohh thank you so much :)
@sonar_devices4 жыл бұрын
Thank you so much!!
@odayprogrammer4 жыл бұрын
thanks :)
@MohammadamirAshrafi4 жыл бұрын
Thanks , that's great
@PhilippLackner4 жыл бұрын
You're welcome!
@chandrasaimohanbhupathi78374 жыл бұрын
Hi Philip ! I am using a TabLayout that displays 3 Tabs. When the app is launched First Tab makes Webservice API call,I am not able to move to second tab until first tab First screen finishes Webservice call execution. Is there a way I can stop my First Tab execution when clicked on 2ndTab .
@mikec42203 жыл бұрын
Are you doing the API call on a different thread?
@chandrasaimohanbhupathi78373 жыл бұрын
Hi @@mikec4220 ! Thanks for replying. The webservice call is made on backgorund thread only. I found that, I am receiving 1000 records from Webservice which I need to populate recyclerview. No paging mechanism implemented from backend. The screen is getting stuck when applying all data to adapter. What I tried is I initialized adapter with empty data before making Webservice call. After receiving data from Webservice , I just updated data to a method in Adapter and called notifyDataSetChanged(). It looked ok as of now but still screen stucks a bit. Any idea on how to handle this kind of stituation from Mobile side if backend does not have paging mechanism.
@mikec42203 жыл бұрын
Hi @@chandrasaimohanbhupathi7837 , I'm learning the ropes myself and by the look of it you are getting this behaviour because you're loading too much data. I believe the pagination was developed to solve this particular issue you are encountering. Also notifyDataSetChanged() is not the best to use with recyclerviews, not in this case at least, my understanding is that it will refresh all the views instead of only the ones needed. Look at diffutils, Phillip has a good example when he is setting up RecyclerView for the NewsApp. Hope this helps!
ViewPager2 is bad. The animation is too slow. When you have menu items, moving from tab 1 to 7, they will only change once animation ends. Dunno why they dont want to fix this.