I have created swipey tabs using ViewPagerExtensions but this time i am using only one library ActionBarSherlock in my App and i dont know how to create swipey tabs like google play store. If you can help me to get it done, i'd be very thankful to you.
This is the onCreate method of my activity class
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(SampleList.THEME); //Used for theme switching in samples
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_tabs);
mTabHost = (TabHost)findViewById(android.R.id.tabhost);
mTabHost.setup();
mTabManager = new TabManager(this, mTabHost, R.id.realtabcontent);
mTabManager.addTab(mTabHost.newTabSpec("simple").setIndicator("Groups"),FragmentStackSupport.CountingFragment.class, null);
mTabManager.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"),LoaderCursorSupport.CursorLoaderListFragment.class, null);
mTabManager.addTab(mTabHost.newTabSpec("custom").setIndicator("Logs"),LoaderCustomSupport.AppListFragment.class, null);
mTabManager.addTab(mTabHost.newTabSpec("throttle").setIndicator("Gallery"),LoaderThrottleSupport.ThrottledLoaderListFragment.class, null);
if (savedInstanceState != null) {
mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
}
}
In first image Top New Paid is the current screen title and other two are showing previous or next screen tile. How can i show previous and next screen title at corner with some fading effect like it.
I had a similar issue but I wasn't implementing any ActionBar at all. I came across this blog which led me to an implementation called "SwipeyTabs" that is simply used with a ViewPager.
http://blog.peterkuterna.net/2011/09/viewpager-meets-swipey-tabs.html
If you are using ActionBarSherlock, you'd better use action bar tabs, not
TabHost
. Also I believe there are samples in ABS that show how to do this.The swipey tabs you are referring to is actually just a ViewPager with corresponding title tabs for each page. This is not included in the Android SDK by default, but you can use Jake Wharton's
ViewPagerIndicator
to add the titles for each tab in your ViewPager. I believe thatActionBarSherlock
(which is also created by Jake Wharton) provides the same exact functionality as well.You need to use ActionBar Tabs, a TabsAdapter and a ViewPager (scrolly bit). Here's a full tutorial I made: http://davidjkelley.net/?p=34 (just use the ABS imports, not standard compatibility library ones).
Here's some of the relevant code:
You'll want to use ViewPager, and ditch the TabHost.
http://developer.android.com/reference/android/support/v4/view/ViewPager.html