android.support.v7.app.ActionBar.Tab Java Examples

The following examples show how to use android.support.v7.app.ActionBar.Tab. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From ui with Apache License 2.0 6 votes vote down vote up
private void setTabNavigation( ActionBar actionBar )
{
	actionBar.removeAllTabs();
	actionBar.setNavigationMode( ActionBar.NAVIGATION_MODE_TABS );
	actionBar.setTitle( R.string.app_name );

	Tab tab = actionBar
			.newTab()
			.setText( R.string.frag1 )
			.setTabListener(
					new MyTabListener( this, Fragment1.class.getName() ) );
	actionBar.addTab( tab );

	tab = actionBar
			.newTab()
			.setText( R.string.frag2 )
			.setTabListener(
					new MyTabListener( this, Fragment2.class.getName() ) );
	actionBar.addTab( tab );
	if (mSpinnerItem != null)
	{
		mSpinnerItem.setVisible( false );
	}
}
 
Example #2
Source File: AbstractTabsAdapter.java    From tup.dota2recipe with Apache License 2.0 5 votes vote down vote up
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
    Object tag = tab.getTag();
    for (int i = 0; i < mTabs.size(); i++) {
        if (mTabs.get(i) == tag) {
            mViewPager.setCurrentItem(i);
        }
    }
}
 
Example #3
Source File: AbstractTabsAdapter.java    From tup.dota2recipe with Apache License 2.0 5 votes vote down vote up
public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) {
    TabInfo info = new TabInfo(clss, args);
    tab.setTag(info);
    tab.setTabListener(this);
    mTabs.add(info);
    mActionBar.addTab(tab);
    notifyDataSetChanged();
}
 
Example #4
Source File: HomeActivity.java    From vocefiscal-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) 
{
	// When the given tab is selected, switch to the corresponding page in
	// the ViewPager.
	mViewPager.setCurrentItem(tab.getPosition());
}
 
Example #5
Source File: ActionBarDisplayOptions.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}
 
Example #6
Source File: MainActivity.java    From tup.dota2recipe with Apache License 2.0 4 votes vote down vote up
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
 
Example #7
Source File: MainActivity.java    From tup.dota2recipe with Apache License 2.0 4 votes vote down vote up
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}
 
Example #8
Source File: ActionBarTabs.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
    Toast.makeText(ActionBarTabs.this, "Reselected!", Toast.LENGTH_SHORT).show();
}
 
Example #9
Source File: ActionBarTabs.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
    ft.remove(mFragment);
}
 
Example #10
Source File: ActionBarTabs.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
    ft.add(R.id.fragment_content, mFragment, mFragment.getText());
}
 
Example #11
Source File: ActionBarDisplayOptions.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
 
Example #12
Source File: MainActivity.java    From ui with Apache License 2.0 4 votes vote down vote up
@Override
public void onTabReselected( Tab tab, FragmentTransaction ft )
{
	// TODO Auto-generated method stub

}
 
Example #13
Source File: ActionBarDisplayOptions.java    From V.FlyoutTest with MIT License 4 votes vote down vote up
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
}
 
Example #14
Source File: HomeActivity.java    From vocefiscal-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) 
{
	//do nothing
}
 
Example #15
Source File: HomeActivity.java    From vocefiscal-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) 
{
	//do nothing
}
 
Example #16
Source File: MainActivity.java    From ui with Apache License 2.0 4 votes vote down vote up
@Override
public void onTabUnselected( Tab tab, FragmentTransaction ft )
{
	ft.remove( mFragment );
	mFragment = null;
}
 
Example #17
Source File: MainActivity.java    From ui with Apache License 2.0 4 votes vote down vote up
@Override
public void onTabSelected( Tab tab, FragmentTransaction ft )
{
	mFragment = Fragment.instantiate( mActivity, mFragName );
	ft.replace( android.R.id.content, mFragment );
}