I'd like to know if it's possible to adapt my actual tabs to create swipable tabs without using fragments.
Right now I have non-swipable tabs (each tab contain an endless list : NewsList).
Here's the code I use for my non-swipable tabs :
tabHost = (TabHost)this.findViewById(R.id.scrollTabs);
// Avant d’ajouter des onglets, il faut impérativement appeler la méthode
// setup() du TabHost
LocalActivityManager mLocalActivityManager = new LocalActivityManager(this, false);
mLocalActivityManager.dispatchCreate(savedInstanceState);
tabHost.setup(mLocalActivityManager);
// Ajoute un onglet pour chaque catégorie de news
tabNewslist = new NewsList[NewsCategory.values().length];
View tabView;
for (int i = 0; i < NewsCategory.values().length; i++) {
tabView = createTabView(tabHost.getContext(), NewsCategory.getValueAt(i).getName());
tabNewslist[i] = new NewsList(this, new LinkedList<Item>(), IdUrlRss.NEWSLIST, NewsCategory.getValueAt(i));
tabHost.addTab(tabHost.newTabSpec(NewsCategory.getValueAt(i).getName()).setIndicator(tabView).setContent(tabNewslist[i]));
}
And here's the XML layout :
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<HorizontalScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none">
<TabWidget android:id="@android:id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</HorizontalScrollView>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</TabHost>
I also tried to create a PagerAdapter for NewsList but I failed.