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


Java FragmentTransaction.show方法代碼示例

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


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

示例1: toggleCallControlFragmentVisibility

import android.app.FragmentTransaction; //導入方法依賴的package包/類
private void toggleCallControlFragmentVisibility() {
  if (!iceConnected || !callFragment.isAdded()) {
    return;
  }
  // Show/hide call control fragment
  callControlFragmentVisible = !callControlFragmentVisible;
  FragmentTransaction ft = getFragmentManager().beginTransaction();
  if (callControlFragmentVisible) {
    ft.show(callFragment);
    ft.show(hudFragment);
  } else {
    ft.hide(callFragment);
    ft.hide(hudFragment);
  }
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
  ft.commit();
}
 
開發者ID:Piasy,項目名稱:AppRTC-Android,代碼行數:18,代碼來源:CallActivity.java

示例2: toggleCallControlFragmentVisibility

import android.app.FragmentTransaction; //導入方法依賴的package包/類
private void toggleCallControlFragmentVisibility() {
    if (!iceConnected || !callFragment.isAdded()) {
        return;
    }
    // Show/hide call control fragment
    callControlFragmentVisible = !callControlFragmentVisible;
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    if (callControlFragmentVisible) {
        ft.show(callFragment);
        ft.show(hudFragment);
    } else {
        ft.hide(callFragment);
        ft.hide(hudFragment);
    }
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ft.commit();
}
 
開發者ID:lgyjg,項目名稱:AndroidRTC,代碼行數:18,代碼來源:CallActivity.java

示例3: showDetails

import android.app.FragmentTransaction; //導入方法依賴的package包/類
/**
 * Hide list, show details and instruct the details view to show the selected book.
 */
@Override
public void showDetails(Book book, Drawable thumb) {
  final FragmentManager fragmentManager = getFragmentManager();
  FragmentTransaction ft = fragmentManager.beginTransaction();
  BookDetailsFragment details = (BookDetailsFragment) fragmentManager.findFragmentById(R.id.book_details);

  if (book != null) {
    // If null passed, we only configure fragment transaction here.
    details.showDetails(book, thumb);
  }

  ft.show(details);
  ft.hide(fragmentManager.findFragmentById(R.id.book_list));
  ft.addToBackStack("details"); // Use the back button to return to the search list view.

  ft.commit();
}
 
開發者ID:andviane,項目名稱:google-books-android-viewer,代碼行數:21,代碼來源:BookListActivity.java

示例4: switchFragment

import android.app.FragmentTransaction; //導入方法依賴的package包/類
private void switchFragment(int index) {
    if (index == mCurrentIndex) return;

    Fragment fragment = mFragments.get(index);
    FragmentTransaction transaction =
            mFragmentManager
                    .beginTransaction()
                    .setCustomAnimations(R.animator.fragment_in, R.animator.fragment_out);

    String indexString = String.valueOf(index);
    Fragment targetFragment = mFragmentManager.findFragmentByTag(indexString);

    if (mCurrentIndex != -1) {
        // 不是首次啟動
        transaction.hide(mFragments.get(mCurrentIndex));
    }

    if (targetFragment == null) {
        // 之前沒有添加過
        transaction.add(R.id.fl_content, fragment, indexString);
    } else {
        transaction.show(targetFragment);
    }

    transaction.commit();
    mCurrentIndex = index;
}
 
開發者ID:iAcn,項目名稱:MBEStyle,代碼行數:28,代碼來源:MainActivity.java

示例5: showFragmentOne

import android.app.FragmentTransaction; //導入方法依賴的package包/類
/**
 * 根據tag顯示viewId裏的一個fragment,其他全部隱藏
 */
public void showFragmentOne(int containerViewId, String tag) {
    FragmentTransaction transaction = getTransaction();
    for (Fragment fragment : getFragmentList(containerViewId)) {
        if (fragment.getTag().equals(tag)) {
            transaction.show(fragment);
        } else if (!fragment.isHidden()) {
            transaction.hide(fragment);
        }
    }
    transaction.commit();
}
 
開發者ID:JJS-CN,項目名稱:JBase,代碼行數:15,代碼來源:BaseActivity.java

示例6: show

import android.app.FragmentTransaction; //導入方法依賴的package包/類
/**使用本方法前必須先add*/
public void show(Fragment fragment){
    if (currentFragment==fragment) {
        return;//如果是當前fragment,則不重新show一遍了,無意義
    }
    FragmentTransaction ft = fm.beginTransaction();
    for (Fragment f:fs) {
        ft.hide(f);
    }
    ft.show(fragment);
    ft.commit();
    currentFragment = fragment;
}
 
開發者ID:WeGdufe,項目名稱:MovingGdufe-Android,代碼行數:14,代碼來源:FragmentUtil.java

示例7: showList

import android.app.FragmentTransaction; //導入方法依賴的package包/類
public void showList() {
  final FragmentManager fragmentManager = getFragmentManager();
  FragmentTransaction ft = fragmentManager.beginTransaction();
  ft.show(fragmentManager.findFragmentById(R.id.book_list));
  ft.hide(fragmentManager.findFragmentById(R.id.book_details));
  ft.commit();
}
 
開發者ID:andviane,項目名稱:google-books-android-viewer,代碼行數:8,代碼來源:BookListActivity.java

示例8: showCamera

import android.app.FragmentTransaction; //導入方法依賴的package包/類
private boolean showCamera(CallbackContext callbackContext) {
  if(this.hasView(callbackContext) == false){
    return true;
  }

  FragmentManager fragmentManager = cordova.getActivity().getFragmentManager();
  FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
  fragmentTransaction.show(fragment);
  fragmentTransaction.commit();

  callbackContext.success();
  return true;
}
 
開發者ID:MrShakes,項目名稱:cameraPreviewStream,代碼行數:14,代碼來源:CameraPreview.java

示例9: showFragment

import android.app.FragmentTransaction; //導入方法依賴的package包/類
private void showFragment(String name) {
    FragmentManager fragmentManager = getFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

    for (Fragment f : fragments.values()) {
        fragmentTransaction.hide(f);
    }

    if (fragments.containsKey(name)) {
        fragmentTransaction.show(fragments.get(name));
        currentFragment = name;
    }

    fragmentTransaction.commit();
}
 
開發者ID:konachan700,項目名稱:SSHFileManager,代碼行數:16,代碼來源:MainActivity.java

示例10: onItemClick

import android.app.FragmentTransaction; //導入方法依賴的package包/類
@Override
public void onItemClick(int i) {
    FragmentTransaction transaction = getFragmentManager().beginTransaction();
    // 隱藏所有的Fragment
    if (exploreFragment != null)
        transaction.hide(exploreFragment);
    if (homeFragment != null)
        transaction.hide(homeFragment);
    if (settingsFragment != null)
        transaction.hide(settingsFragment);
    // 顯示被選中的Fragment
    switch (i) {
        case 0:     // 動態
            if (homeFragment == null) {
                homeFragment = new HomeFragment();
                transaction.add(R.id.container, homeFragment);
            } else
                transaction.show(homeFragment);
            setTitle(R.string.dynamic);
            break;
        case 1:     // 發現
            if (exploreFragment == null) {
                exploreFragment = new ExploreFragment();
                transaction.add(R.id.container, exploreFragment);
            } else
                transaction.show(exploreFragment);
            setTitle(R.string.explore);
            break;
        case 3:
            if (settingsFragment == null) {
                settingsFragment = new SettingsFragment();
                transaction.add(R.id.container, settingsFragment);
            } else
                transaction.show(settingsFragment);
            setTitle("設置");
    }
    transaction.commit();
}
 
開發者ID:moe2studio,項目名稱:PangciACG,代碼行數:39,代碼來源:MainActivity.java

示例11: showFragment

import android.app.FragmentTransaction; //導入方法依賴的package包/類
private void showFragment(String tag) {
    if (mCurrentPageTag.equals(tag)) {
        Log.d(TAG, "showFragment: return");
        return;
    }

    FragmentTransaction beginTransaction= mFragmentManager.beginTransaction();
    hidePreFragment(beginTransaction);

    switch (tag) {
        case HOME_PAGE_TAG:
            if (mHomeFragment == null) {
                mHomeFragment = new HomeFragment();
                beginTransaction.add(R.id.fragment_area, mHomeFragment, tag);
            } else {
                beginTransaction.show(mHomeFragment);
            }
            mActionBarTitle.setText(R.string.app_name);
            mHomeBtn.setTextColor(focusTextColor);
            break;

        case EXPLORE_PAGE_TAG:
            if (mExploreFragment == null) {
                mExploreFragment = new ExploreFragment();
                beginTransaction.add(R.id.fragment_area, mExploreFragment, tag);
            } else {
                beginTransaction.show(mExploreFragment);
            }
            mActionBarTitle.setText(R.string.bottom_bar_explore);
            mExploreBtn.setTextColor(focusTextColor);
            break;

        case MINE_PAGE_TAG:
            if (mMineFragment == null) {
                mMineFragment = new MineFragment();
                beginTransaction.add(R.id.fragment_area, mMineFragment, tag);
            } else {
                beginTransaction.show(mMineFragment);
            }
            mActionBarTitle.setText(R.string.bottom_bar_mine);
            mMineBtn.setTextColor(focusTextColor);
            break;
    }

    mCurrentPageTag = tag;
    beginTransaction.addToBackStack(tag);
    beginTransaction.commit();
}
 
開發者ID:AndroidWJC,項目名稱:UnversityFinance,代碼行數:49,代碼來源:MainActivity.java


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