Here as you can see I used TabLayout,TabHost. I used TabLayout in first twice pictures. In third picture I used TabHost. Usually, TabLayout is looking better than TabHost/TabWidget.TabHost as you can see TabHost is deprecated. So, It would be better if I don't use TabHost. TabLayout isn't deprecated. Here is a question I asked someone said it is duplicate. I thought it was. Look, while I am using ViewPager and TabLayout I can't use those layout directly in MainActivity I meant I have to write source code inside those framgents class to work right there. But, while I am using TabHost,TabWidget and TabContent I can use those layouts directly in MainActivity I don't have to write source code somewhere else. Like I used in ViewPager or Fragments. So, it is the problem between TabLayout and TabHost. And, TabHost or TabWidget isn't scrollable which means I can't scroll TabWidget like I did in TabLayout. There's another problem arise. So, TabLayout and TabHost isn't same. So, it would be better if I don't use TabLayout alternative of Tabhost.
In my project I need scrollable tabs like TabLayout and, I have to access those layouts from my MainActivity. So, I can't use TabLayout. Although I tried to use it. But, is there any possible way to use only layouts inside ViewPager and access those layouts from MainActivity.



It was terrible question I had asked. There's better way to do it. I was thinking how to do that. Then, I used
TabLayoutandFrameLayout. I thoughtFrameLayoutwill hide others linearlayout without firstlayout. Then, I had added to myactivity_main.xmlBut,
FrameLayoutdidn't work as I thought. So, I discouraged again. But, I keep thinking of it. I didn't remove anything. Then, something else came to my head. What if I hide otherslinearLayoutwithout first ones. How I thoughtFramelayoutshould work. Then, I set onLinearLayoutVisibility = "GONE".So, while I am clicking on another
tabsit is hiding others layout without main ones. So, it worked for me. There's no alternative I have get. I will say that it is my answer.