238 Android SlidingTabLayout Part 1 |
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about replacing the deprecated ActionBar tab navigation mode with sliding tabs and a ViewPager.
Recommended by 4 people across 3 different months, 2015 to 2016.
What it is
A 2015 Android tutorial from the slidenerd channel showing how to add swipeable tabs under a Material Design toolbar. It walks through copying the SlidingTabLayout and SlidingTabStrip classes, declaring the view in XML, and wiring a PagerAdapter and Fragments to a ViewPager.
What people said
Recommends user4593707 · 2015-02 · Stack Overflow · on “Best way to make swipe tabs”
Use a Sliding tab Layout. Get the Sliding Tab Layout & Sliding Tab Strip java file in the following link. [LINK] Copy the 2 into your project and follow the follwing tutorial. Note: Dont copy the one in the developers android website its not updated as far as I know [this video] I had the same problem.
Recommends keshav kowshik · 2015-03 · Stack Overflow · on “Why getting null pointer exception when using actionbar.setNavigationMode?”
You are getting null pointer exception since the method actionBar.setNavigationMode is deprecated in the latest API. You can use the SlidingTabLayout as an alternative. Check the following link for more information and an example of how to use SlidingTabs [this video] Hope this helps.
Recommends keshav kowshik · 2015-03 · Stack Overflow · on “Why getting null pointer exception when using actionbar.setNavigationMode?”
Which api are you using. Actionbar.setNavigation mode is deprecated in the latest one. Use Sliding tabs check this link: [this video]
Recommends David Read · 2015-04 · Stack Overflow · on “Android Studio - Sliding Tabs appear below action bar instead of on action bar”
To answer my own question, it will take a few steps to achieve this. First you need to create your own custom action bar in an seperate XML file. Then you need to apply a "NoActionBar" Theme to the activity that you want to put the action bar with silding tabs in. Then you need to write in Java that you want to set the action bar in that particular activity to your own custom action bar. Then I believe, don't quote me, you need to add the sliding tabs in the action bar layout file along with the view pager. Obviously there are a lot of steps and it is very hard to explain them in this way. SlideNerd has a superb set of video tutorials on how to do this in case you're a visual learner. Custom
Recommends kip2 · 2015-04 · Stack Overflow · on “Action bar navigation modes are deprecated in Android L”
I found these tutorials helpful while putting together an action bar (now the 'tool bar' - argh) that supports sliding tabs with Material Design: [this video] [LINK] You sort of have to synthesize these resources to match your particular situation. For example, you may not want to manually create the tabs in the same style that the exoguru.com tutorial did.
Recommends keshav kowshik · 2015-04 · Stack Overflow · on “Android RuntimeException and NullPointerException from Login to MainActivity”
In API 21, the following method of using tabs is deprecated. You need to use sidingTabs instead of this: actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);`// this is deprecated. Check the following link for the implementation of sliding tabs: [this video] Hope this helps.
Cites liakourinio · 2016-04 · Stack Overflow · on “Master/Detail flow with a FragmentPagerAdapter in DetailsFragment”
I have implemented the Master/Detail flow in my Android project. I have an Activity called "StatisticsActivity" whose layout has 2 fragments, the PlayerStatsFragment (as master) and the GameStatsFragment (as detail). So far all good, the problem is that I want inside the GameStatsFragment to be 2 Tabs (Fragment301 and Fragment302), so when I choose an item from PlayersFragment to send an id(playerId) and show diferent content in GamesFragments. I hope the image helps to understand: [LINK] I followed this 3 part tutorial [this video] and I have implemented a FragmentPagerAdapter to create the tabs(and FragmentA, FragmentB). The problem is that in the GamesFragment I receive the playersId but in th