I’m using SwipeyTabs in my application. I’m not sure how to fill tabs content. It does not even have any own xml.
I’m using tabs like this:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_swipey_tabs);
initViewPager(4, 0xFFFFFFFF, 0xFF000000);
mSwipeyTabs = (SwipeyTabsView) findViewById(R.id.swipey_tabs);
mSwipeyTabsAdapter = new SwipeyTabsAdapter(this);
mSwipeyTabs.setAdapter(mSwipeyTabsAdapter);
mSwipeyTabs.setViewPager(mPager);
}
private void initViewPager(int pageCount, int backgroundColor, int textColor) {
mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new ExamplePagerAdapter(this, pageCount, backgroundColor, textColor);
mPager.setAdapter(mPagerAdapter);
mPager.setCurrentItem(1);
mPager.setPageMargin(1);
}
And here is activity_swipey_tabs.xml layout:
<android.ex.com.viewpager.extension.SwipeyTabsView
android:id="@+id/swipey_tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#3B3B3B" />
<View
android:id="@+id/colorline"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_below="@+id/swipey_tabs"
android:background="#FF91A438" />
<View
android:id="@+id/blackline"
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_below="@+id/colorline"
android:background="#FF000000" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/blackline" />
Are there any examples or tutorials?
Any support would great.
Tabs of
SwipeyTabsare like virtual layout, I mean they don’t have own defined layout. You should define every component in dynamically.Let me explain with details. In example, you need a ListView (custom). You created layout like this:
Now you need an
ArrayAdaptertoo for adapting this customListView, I’m not includingArrayAdapter.So in your
PagerAdapterclass, define aListViewand use this layout. In example:Now it’s work well. If you need more tabs, use
positionparameter as a seperator likeif(position == 0). In this you’re gonna need this line:That’s all. I hope, it’s clear.