use of carbon.widget.RelativeLayout in project Carbon by ZieIony.
the class TabsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tabs);
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new PagerAdapter() {
@Override
public CharSequence getPageTitle(int position) {
return "Page " + position;
}
public View getView(int position, ViewPager pager) {
return new RelativeLayout(pager.getContext(), null, R.attr.carbon_cardViewStyle);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public int getCount() {
return 7;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
ViewPager pager = (ViewPager) container;
View view = getView(position, pager);
pager.addView(view);
return view;
}
@Override
public void destroyItem(ViewGroup container, int position, Object view) {
((ViewPager) container).removeView((View) view);
}
});
PagerTabStrip tabs = (PagerTabStrip) findViewById(R.id.pager_title_strip);
tabs.setViewPager(pager);
}
Aggregations