android.app.FragmentTransaction.show()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(166)

本文整理了Java中android.app.FragmentTransaction.show()方法的一些代码示例,展示了FragmentTransaction.show()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentTransaction.show()方法的具体详情如下:
包路径:android.app.FragmentTransaction
类名称:FragmentTransaction
方法名:show

FragmentTransaction.show介绍

暂无

代码示例

代码示例来源:origin: facebook/facebook-android-sdk

private void showFragment(int fragmentIndex, boolean addToBackStack) {
    FragmentManager fm = getFragmentManager();
    FragmentTransaction transaction = fm.beginTransaction();
    for (int i = 0; i < fragments.length; i++) {
      if (i == fragmentIndex) {
        transaction.show(fragments[i]);
      } else {
        transaction.hide(fragments[i]);
      }
    }
    if (addToBackStack) {
      transaction.addToBackStack(null);
    }
    transaction.commit();
  }
}

代码示例来源:origin: reloZid/android-anuto

private void show(int textId, boolean showSkipButton) {
  txt_content.setText(textId);
  btn_skip.setVisibility(showSkipButton ? View.VISIBLE : View.GONE);
  if (!mVisible) {
    getFragmentManager().beginTransaction()
        .show(TutorialFragment.this)
        .commitAllowingStateLoss();
    mVisible = true;
  }
}

代码示例来源:origin: THEONE10211024/ApiDemos

void updateFragmentVisibility() {
  FragmentTransaction ft = getFragmentManager().beginTransaction();
  if (mCheckBox1.isChecked()) ft.show(mFragment1);
  else ft.hide(mFragment1);
  if (mCheckBox2.isChecked()) ft.show(mFragment2);
  else ft.hide(mFragment2);
  ft.commit();
}

代码示例来源:origin: qiubiteme/android_api_demos

void updateFragmentVisibility() {
  FragmentTransaction ft = getFragmentManager().beginTransaction();
  if (mCheckBox1.isChecked()) ft.show(mFragment1);
  else ft.hide(mFragment1);
  if (mCheckBox2.isChecked()) ft.show(mFragment2);
  else ft.hide(mFragment2);
  ft.commit();
}

代码示例来源:origin: qiubiteme/android_api_demos

void updateFragmentVisibility() {
    FragmentTransaction ft = getChildFragmentManager().beginTransaction();
    if (mCheckBox1.isChecked()) ft.show(mFragment1);
    else ft.hide(mFragment1);
    if (mCheckBox2.isChecked()) ft.show(mFragment2);
    else ft.hide(mFragment2);
    ft.commit();
  }
}

代码示例来源:origin: THEONE10211024/ApiDemos

void updateFragmentVisibility() {
    FragmentTransaction ft = getChildFragmentManager().beginTransaction();
    if (mCheckBox1.isChecked()) ft.show(mFragment1);
    else ft.hide(mFragment1);
    if (mCheckBox2.isChecked()) ft.show(mFragment2);
    else ft.hide(mFragment2);
    ft.commit();
  }
}

代码示例来源:origin: trishika/DroidUPnP

public void show()
{
  Activity a = getActivity();
  if (a==null)
    return;
  a.findViewById(R.id.progressBar).setVisibility(View.VISIBLE);
  a.findViewById(R.id.separator).setVisibility(View.VISIBLE);
  getFragmentManager().beginTransaction().show(this).commit();
}

代码示例来源:origin: stackoverflow.com

AbsMessageFragment fragDisplay = (AbsMessageFragment)
  mFM.findFragmentById(R.id.fragment_id_message_display);

if (fragDisplay != null) {
  FragmentTransaction ft = mFM.beginTransaction();
  ft.setTransition(FragmentTransaction.TRANSIT_NONE);
  ft.show(some other fragment);
  ft.hide(fragDisplay);

代码示例来源:origin: qiubiteme/android_api_demos

public void onClick(View v) {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.setCustomAnimations(android.R.animator.fade_in,
        android.R.animator.fade_out);
    if (fragment.isHidden()) {
      ft.show(fragment);
      button.setText("Hide");
    } else {
      ft.hide(fragment);
      button.setText("Show");
    }
    ft.commit();
  }
});

代码示例来源:origin: flyleft/xmarket

switch (position) {
  case 0 : if (schoolFragment != null) {
    ft.show(schoolFragment);
  } else {
    schoolFragment = new SchoolFragment();
    ft.show(tradeTagFragment);
  } else {
    tradeTagFragment = new TradeTagFragment();
    ft.show(teamFragment);
  } else {
    teamFragment = new TeamFragment();
    ft.show(messageFragment);
  } else {
    messageFragment = new MessageFragment();

代码示例来源:origin: THEONE10211024/ApiDemos

public void onClick(View v) {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.setCustomAnimations(android.R.animator.fade_in,
        android.R.animator.fade_out);
    if (fragment.isHidden()) {
      ft.show(fragment);
      button.setText("Hide");
    } else {
      ft.hide(fragment);
      button.setText("Show");
    }
    ft.commit();
  }
});

代码示例来源:origin: reloZid/android-anuto

private void show() {
  if (!mVisible) {
    updateMenuTransparency();
    getFragmentManager().beginTransaction()
        .show(this)
        .commitAllowingStateLoss();
    mVisible = true;
  }
}

代码示例来源:origin: reloZid/android-anuto

@Override
  public void run() {
    updateScore();
    getFragmentManager().beginTransaction()
        .setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out)
        .show(GameOverFragment.this)
        .commitAllowingStateLoss();
  }
});

代码示例来源:origin: reloZid/android-anuto

private void show() {
  if (!mVisible) {
    updateMenuTransparency();
    getFragmentManager().beginTransaction()
        .show(this)
        .commitAllowingStateLoss();
    mVisible = true;
  }
}

代码示例来源:origin: andviane/google-books-android-viewer

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();
}

代码示例来源:origin: RWebRTC/WebRTC-Android-Learn

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();
}

代码示例来源:origin: andviane/google-books-android-viewer

/**
 * 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();
}

代码示例来源:origin: WowzaMediaSystems/gocoder-sdk-samples-android

private void showSettings(View v){
  // Display the prefs fragment
  WOWZLog.debug("*** getOriginalFrameSizes showSettings1");
  prefsFragment.setActiveCamera(mWZCameraView != null ? mWZCameraView.getCamera() : null);
  WOWZLog.debug("*** getOriginalFrameSizes showSettings2");
  getFragmentManager().addOnBackStackChangedListener(backStackListener);
  getFragmentManager().beginTransaction()
      .replace(android.R.id.content, prefsFragment)
      .addToBackStack(null)
      .show(prefsFragment)
      .commit();
  WOWZLog.debug("*** getOriginalFrameSizes showSettings3");
}

代码示例来源:origin: geniusgithub/AndroidDialer

ft.add(R.id.dialtacts_container, mDialpadFragment, TAG_DIALPAD_FRAGMENT);
} else {
  ft.show(mDialpadFragment);

代码示例来源:origin: CodingBingo/FastReader

private void initView() {
  mReadingFragment = new ReadingFragment();
  mReadingFragment.setBookId(bookId);
  mReadingFragment.setBookPath(bookPath);
  mReadingFragment.setOnClickListener(this);
  mChapterListFragment = new ChapterListFragment();
  mChapterListFragment.setBookId(bookId);
  mChapterListFragment.setBookPath(bookPath);
  if (mReadingFragment.isAdded()){
    getFragmentManager()
        .beginTransaction()
        .show(mReadingFragment)
        .commitAllowingStateLoss();
  } else{
    getFragmentManager()
        .beginTransaction()
        .add(R.id.reading_container, mReadingFragment)
        .commitAllowingStateLoss();
  }
}

相关文章