ActionBarSherlock › How to implement TabNavigation on SherlockActionbar + RoboGuice?
-
08-12-2019 - |
Pregunta
I'm using RoboGuice+SherlockActionBar-V4.0 and building a sample app to test tab-navigation , I checked the roboguice-sherlock example which is coming with SherlockActionBar package but ... no help .
How can I switch the activities with the Tabs ?
//old method was .
spec = tabHost.newTabSpec("tab1").setIndicator(null,
res.getDrawable(R.drawable.ic_tab_capture))
.setContent(new Intent(this,TabOne.class));
tabHost.addTab(spec);
If any sample code is available then it should be great for me.
Thanks in advance .
Solución
From their sample code, you can try the following:
for (int i = 1; i <= 3; i++) {
ActionBar.Tab tab = getSupportActionBar().newTab();
tab.setText("Tab " + i);
tab.setIcon(R.drawable.abs__ic_cab_done_holo_light);
tab.setTabListener(this);
getSupportActionBar().addTab(tab);
}
This works in my 2.3.3 environment, using ABS4 and RoboGuice.
Otros consejos
I have successfully setup Tabs on SherlockActionbar+RoboGuice with the help of this snippet . http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.html , Sample app > https://bitbucket.org/ashish2py/sherlockrobotab