當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。