本文整理汇总了Java中android.app.FragmentTransaction.hide方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentTransaction.hide方法的具体用法?Java FragmentTransaction.hide怎么用?Java FragmentTransaction.hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.FragmentTransaction
的用法示例。
在下文中一共展示了FragmentTransaction.hide方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hidePreFragment
import android.app.FragmentTransaction; //导入方法依赖的package包/类
private void hidePreFragment(FragmentTransaction transaction) {
Log.d(TAG, "hidePreFragment: mCurrentPageTag = "+mCurrentPageTag);
switch (mCurrentPageTag) {
case HOME_PAGE_TAG:
transaction.hide(mHomeFragment);
mHomeBtn.setTextColor(textColor);
break;
case EXPLORE_PAGE_TAG:
transaction.hide(mExploreFragment);
mExploreBtn.setTextColor(textColor);
break;
case MINE_PAGE_TAG:
transaction.hide(mMineFragment);
mMineBtn.setTextColor(textColor);
break;
}
}
示例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();
}
示例3: 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();
}
示例4: 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();
}
示例5: onCreate
import android.app.FragmentTransaction; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!runFirst) return;
if (savedInstanceState == null) {
fileManagerFragment.create(this.getApplicationContext(), this);
waiterFragment.create();
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
for (Fragment f : fragments.values()) {
fragmentTransaction.add(R.id.rootContainer, f);
fragmentTransaction.hide(f);
}
fragmentTransaction.commit();
showFragment("server_list");
sshServersSelector.setActionListener(this);
fileManagerFragment.setActionListener(this);
runFirst = false;
}
}
示例6: 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;
}
示例7: 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();
}
示例8: 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;
}
示例9: 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();
}
示例10: hideCamera
import android.app.FragmentTransaction; //导入方法依赖的package包/类
private boolean hideCamera(CallbackContext callbackContext) {
if(this.hasView(callbackContext) == false){
return true;
}
FragmentManager fragmentManager = cordova.getActivity().getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.hide(fragment);
fragmentTransaction.commit();
callbackContext.success();
return true;
}
示例11: 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();
}
示例12: 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();
}