crear pestaña personalizada en FragmentActivity
Estoy tratando de crear una pestaña personalizada en Android, he creado las pestañas enFragmentActivity
yFragmentPagerAdapter
Aquí está el código de, pero realmente no sé dónde inflar las pestañas personalizadas usando
View tabIndicator = LayoutInflater.from(mContext).
inflate(R.layout.tab_item, mTabHost.getTabWidget(), false);
code en el método onCreate de FragmentActivity
mTabHost = (TabHost)findViewById(android.R.id.tabhost);
mTabHost.setup();
if(mTabHost!=null) System.out.println("***ITS NOT NULL****");
mViewPager = (ViewPager)findViewById(R.id.pager);
mTabsAdapter = new TabsAdapter(this, mTabHost, mViewPager);
mTabsAdapter.addTab(mTabHost.newTabSpec("simple").setIndicator("Contacts"),
ContactSummaryFragment.class, null);
mTabsAdapter.addTab(mTabHost.newTabSpec("custom").setIndicator("Template"),
TextVoiceTemplate.class, null);
addTab method
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
tabSpec.setContent(new DummyTabFactory(mContext));
// I got to place this line somewhere here i guess
//View tabIndicator = LayoutInflater.from(mContext).inflate(R.layout.tab_item, mTabHost.getTabWidget(), false);
String tag = tabSpec.getTag();
TabInfo info = new TabInfo(tag, clss, args);
mTabs.add(info);
mTabHost.addTab(tabSpec);
notifyDataSetChanged();
}