當前位置: 首頁>>代碼示例>>Java>>正文


Java FragmentTransaction.detach方法代碼示例

本文整理匯總了Java中android.app.FragmentTransaction.detach方法的典型用法代碼示例。如果您正苦於以下問題:Java FragmentTransaction.detach方法的具體用法?Java FragmentTransaction.detach怎麽用?Java FragmentTransaction.detach使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.FragmentTransaction的用法示例。


在下文中一共展示了FragmentTransaction.detach方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onAttachView

import android.app.FragmentTransaction; //導入方法依賴的package包/類
@Override
protected void onAttachView(@NonNull View view) {
  super.onAttachView(view);

  //noinspection ConstantConditions
  FragmentManager fm = getActivity().getFragmentManager();
  Fragment fragment = fm.findFragmentByTag(getFragmentTag());

  if (fragment == null) {
    fragment = onCreateFragment();
    fm.beginTransaction().add(getContainerId(), fragment, getFragmentTag()).commit();
  } else {
    FragmentTransaction transaction = fm.beginTransaction();
    // transaction.attach() may not work if the the fragment isn't detached
    if (!fragment.isDetached()) {
      transaction.detach(fragment);
    }
    transaction.attach(fragment).commit();
  }
}
 
開發者ID:seven332,項目名稱:Stage,代碼行數:21,代碼來源:FragmentScene.java

示例2: detach

import android.app.FragmentTransaction; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public void detach(Fragment fragment,
                   FragmentTransaction currTransaction) {
    currTransaction.detach(fragment);
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:6,代碼來源:ArrayPagerAdapter.java

示例3: onTabUnselected

import android.app.FragmentTransaction; //導入方法依賴的package包/類
/**
 * @brief Method called when the tab is unselected
 * @param tab
 * @param ft
 * @details Method called when the tab is unselected
 */
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
	  
	  if (mFragment != null) {
      // Detach the fragment, because another one is being attached
      ft.detach(mFragment);
    }
	  
  }
 
開發者ID:CodyyAndroid,項目名稱:LibVNCAndroid,代碼行數:16,代碼來源:TabListener.java

示例4: reloadFragment

import android.app.FragmentTransaction; //導入方法依賴的package包/類
public static void reloadFragment(FragmentManager fragmentManager, Fragment fragment, int containViewId) {
	if (fragment != null){
		FragmentTransaction ft = fragmentManager.beginTransaction();
		ft.setTransition(-1);
//		ft.replace(containViewId, fragment);
		ft.detach(fragment);
		ft.attach(fragment);
		ft.commitAllowingStateLoss();
	}
}
 
開發者ID:WowWeeLabs,項目名稱:CHIP-Android-SDK,代碼行數:11,代碼來源:FragmentHelper.java


注:本文中的android.app.FragmentTransaction.detach方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。