当前位置: 首页>>代码示例>>Java>>正文


Java Tab类代码示例

本文整理汇总了Java中com.actionbarsherlock.app.ActionBar.Tab的典型用法代码示例。如果您正苦于以下问题:Java Tab类的具体用法?Java Tab怎么用?Java Tab使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Tab类属于com.actionbarsherlock.app.ActionBar包,在下文中一共展示了Tab类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onTabSelected

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
	// TODO Auto-generated method stub
	
	switch(tab.getPosition()) {
	case 0:
		NormalFragment frag = new NormalFragment();
		ft.replace(android.R.id.content, frag);
		getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#33b5e5")));
		enableNormal();
		break;
	case 1:
		BatteryFragment frag1 = new BatteryFragment();
		ft.replace(android.R.id.content, frag1);
		getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ff5858")));
		enableBattery();
		break;
	
	}
	
	
}
 
开发者ID:iamareebjamal,项目名称:xbsc_xposed,代码行数:23,代码来源:KolurChuser.java

示例2: onTabSelected

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
  public void onTabSelected(Tab tab, FragmentTransaction transaction) {

  	switch (tab.getPosition()) {
case POSITION_TAB_NUMERIC:
  	   	mWebViewTab1.setVisibility(View.VISIBLE);    		
  	   	mWebViewTab2.setVisibility(View.GONE);
  	   	mWebViewTab3.setVisibility(View.GONE);			
	break;
case POSITION_TAB_QUICKNAV:
  	   	mWebViewTab1.setVisibility(View.GONE);    		
  	   	mWebViewTab2.setVisibility(View.VISIBLE);
  	   	mWebViewTab3.setVisibility(View.GONE);			
	break;
case POSITION_TAB_ADVANCED:
  	   	mWebViewTab1.setVisibility(View.GONE);    		
  	   	mWebViewTab2.setVisibility(View.GONE);
  	   	mWebViewTab3.setVisibility(View.VISIBLE);			
	break;

default:
	break;
}
  }
 
开发者ID:vikingbrain,项目名称:droidedmediatank,代码行数:25,代码来源:RemoteControlActivity.java

示例3: onCreate

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    setTheme(SampleList.THEME); //Used for theme switching in samples
    super.onCreate(savedInstanceState);

    setContentView(R.layout.tab_navigation);
    mSelected = (TextView)findViewById(R.id.text);

    getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    for (int i = 1; i <= 3; i++) {
        ActionBar.Tab tab = getSupportActionBar().newTab();
        tab.setText("Tab " + i);
        tab.setTabListener(this);
        getSupportActionBar().addTab(tab);
    }
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:17,代码来源:TabNavigation.java

示例4: addFragment

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
public void addFragment(Fragment fragment)
{
	// Select proper stack
	Tab tab = getSupportActionBar().getSelectedTab();
	Stack<String> backStack = backStacks.get(tab.getTag());

	FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
	// Animate transfer to new fragment
	//		ft.setCustomAnimations(R.anim.slide_from_left, R.anim.slide_to_right);
	// Get topmost fragment
	String tag = backStack.peek();
	Fragment top = getSupportFragmentManager().findFragmentByTag(tag);
	ft.detach(top);
	// Add new fragment
	addFragment(fragment, backStack, ft);
	ft.commit();
}
 
开发者ID:conchyliculture,项目名称:wikipoff,代码行数:18,代码来源:WikiManagerActivity.java

示例5: onResume

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
protected void onResume()
{
	super.onResume();
	// Select proper stack
	Tab tab = getSupportActionBar().getSelectedTab();
	Stack<String> backStack = backStacks.get(tab.getTag());
	if (! backStack.isEmpty())
	{
		// Restore topmost fragment (e.g. after application switch)
		String tag = backStack.peek();
		Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag);
		if (fragment.isDetached())
		{
			FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
			ft.attach(fragment);
			ft.commit();
		}
	}
}
 
开发者ID:conchyliculture,项目名称:wikipoff,代码行数:21,代码来源:WikiManagerActivity.java

示例6: onPause

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
protected void onPause()
{
	super.onPause();
	// Select proper stack
	Tab tab = getSupportActionBar().getSelectedTab();
	Stack<String> backStack = backStacks.get(tab.getTag());
	if (! backStack.isEmpty())
	{
		// Detach topmost fragment otherwise it will not be correctly displayed
		// after orientation change
		String tag = backStack.peek();
		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
		Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag);
		ft.detach(fragment);
		ft.commit();
	}
}
 
开发者ID:conchyliculture,项目名称:wikipoff,代码行数:19,代码来源:WikiManagerActivity.java

示例7: onBackPressed

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
public void onBackPressed()
{
	// Select proper stack
	Tab tab = getSupportActionBar().getSelectedTab();
	Stack<String> backStack = backStacks.get(tab.getTag());
	String tag = backStack.pop();
	if (backStack.isEmpty())
	{
		// Let application finish
		super.onBackPressed();
	}
	else
	{
		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
		Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag);
		// Animate return to previous fragment
		//	ft.setCustomAnimations(R.anim.slide_from_right, R.anim.slide_to_left);
		// Remove topmost fragment from back stack and forget it
		ft.remove(fragment);
		showFragment(backStack, ft);
		ft.commit();
	}
}
 
开发者ID:conchyliculture,项目名称:wikipoff,代码行数:25,代码来源:WikiManagerActivity.java

示例8: onTabReselected

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft)
{
	// Select proper stack
	Stack<String> backStack = backStacks.get(tab.getTag());

	//		if (backStack.size() > 1)
	//			ft.setCustomAnimations(R.anim.slide_from_right, R.anim.slide_to_left);
	// Clean the stack leaving only initial fragment
	while (backStack.size() > 1)
	{
		// Pop topmost fragment
		String tag = backStack.pop();
		Fragment fragment = getSupportFragmentManager().findFragmentByTag(tag);
		// Remove it
		ft.remove(fragment);
	}
	showFragment(backStack, ft);
}
 
开发者ID:conchyliculture,项目名称:wikipoff,代码行数:20,代码来源:WikiManagerActivity.java

示例9: onCreate

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

       setContentView(R.layout.codecs_pager);

       final ActionBar ab = getSupportActionBar();
       ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
       
       ab.setDisplayShowHomeEnabled(true);
       ab.setDisplayShowTitleEnabled(true);
       
       mViewPager = (ViewPager) findViewById(R.id.pager);
       TabsAdapter tabAdapter = new TabsAdapter(this, ab, mViewPager);
       useCodecsPerSpeed = SipConfigManager.getPreferenceBooleanValue(this, SipConfigManager.CODECS_PER_BANDWIDTH);
       showVideoCodecs   = SipConfigManager.getPreferenceBooleanValue(this, SipConfigManager.USE_VIDEO);
       if(useCodecsPerSpeed) {
           Tab audioNb = ab.newTab().setText( R.string.slow ).setIcon(R.drawable.ic_prefs_media);
           Tab audioWb = ab.newTab().setText( R.string.fast ).setIcon(R.drawable.ic_prefs_media);
           tabAdapter.addTab(audioWb, CodecsFragment.class);
           tabAdapter.addTab(audioNb, CodecsFragment.class);
           if(showVideoCodecs) {
               Tab videoNb = ab.newTab().setText( R.string.slow ).setIcon(R.drawable.ic_prefs_media_video);
               Tab videoWb = ab.newTab().setText( R.string.fast ).setIcon(R.drawable.ic_prefs_media_video);
               
               tabAdapter.addTab(videoWb, CodecsFragment.class);
               tabAdapter.addTab(videoNb, CodecsFragment.class);
           }
       }else {
           Tab audioTab = ab.newTab().setIcon(R.drawable.ic_prefs_media);
           tabAdapter.addTab(audioTab, CodecsFragment.class);
           
           if(showVideoCodecs) {
               Tab videoTab = ab.newTab().setIcon(R.drawable.ic_prefs_media_video);
               tabAdapter.addTab(videoTab, CodecsFragment.class);
           }
       }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:39,代码来源:Codecs.java

示例10: onTabSelected

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
    clearDetails();
    if (mViewPager.getCurrentItem() != tab.getPosition()) {
        mViewPager.setCurrentItem(tab.getPosition(), true);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:8,代码来源:SipHome.java

示例11: onTabSelected

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
	// on tab selected
	// show respected fragment view
	viewPager.setCurrentItem(tab.getPosition());

}
 
开发者ID:dbooga,项目名称:MonsterHunter3UDatabase,代码行数:8,代码来源:MonsterGridActivity.java

示例12: addTab

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
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();
}
 
开发者ID:bhavyanshu,项目名称:CheckIt_Android,代码行数:9,代码来源:TabsAdapter.java

示例13: onTabSelected

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
	Object tag = tab.getTag();
	for (int i = 0, n = mTabs.size(); i < n; i++) {
		if (mTabs.get(i) == tag) {
			mSelectedItem = i;
			mViewPager.setCurrentItem(i);
			break;
		}
	}
}
 
开发者ID:EnteriseToolkit,项目名称:codetalk,代码行数:12,代码来源:MessageViewerActivity.java

示例14: onTabSelected

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@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);
		}
	}
}
 
开发者ID:rykerwilliams,项目名称:androminion,代码行数:10,代码来源:TabsAdapter.java

示例15: onTabSelected

import com.actionbarsherlock.app.ActionBar.Tab; //导入依赖的package包/类
@Override
public void onTabSelected(final Tab tab, final FragmentTransaction ft) {
	mParent.removeAllViews();
	if (mFragment == null) {
		mFragment = Fragment.instantiate(mActivity, mClass.getName());
		ft.add(mParent.getId(), mFragment, mTag);
	} else {
		// If it exists, simply attach it in order to show it
		ft.attach(mFragment);
	}
}
 
开发者ID:razielsarafan,项目名称:lastfm-for-android,代码行数:12,代码来源:GenericsTabListener.java


注:本文中的com.actionbarsherlock.app.ActionBar.Tab类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。