当前位置: 首页>>代码示例>>Java>>正文


Java FragmentTransaction.setCustomAnimations方法代码示例

本文整理汇总了Java中android.support.v4.app.FragmentTransaction.setCustomAnimations方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentTransaction.setCustomAnimations方法的具体用法?Java FragmentTransaction.setCustomAnimations怎么用?Java FragmentTransaction.setCustomAnimations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.app.FragmentTransaction的用法示例。


在下文中一共展示了FragmentTransaction.setCustomAnimations方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onClick

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@Override
public void onClick(SwitcherButtonState state) {
	FragmentTransaction ft = getSupportFragmentManager()
			.beginTransaction();
	ft.setCustomAnimations(R.anim.fragment_fadein,
			R.anim.fragment_fadeout);
	switch (state) {
	case LEFT:
		// mHeaderLayout.myMsgTitle("消息", "我帮", "帮我", new
		// OnSwitcherButtonClickListener());
		ft.replace(R.id.message_layout_content, mMessageFragment)
				.commit();
		break;

	case RIGHT:
		// mHeaderLayout.myMsgTitle("消息", "我帮", "帮我", new
		// OnSwitcherButtonClickListener());
		ft.replace(R.id.message_layout_content, mHelperFragment)
				.commit();
		break;
	}
}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:23,代码来源:MessageActivity.java

示例2: replaceFragment

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
 * 替换碎片
 * 为了保证不出现碎片重叠现象,手动禁用控件并延迟启用
 * @param fragment
 * @param slideType
 */
private void replaceFragment(Fragment fragment, int slideType) {

    FragmentManager manager = getActivity().getSupportFragmentManager();
    FragmentTransaction transaction = manager.beginTransaction();

    switch (slideType){
        case SLIDE_FROM_LEFT_TO_RIGHT:
            transaction.setCustomAnimations(R.anim.slide_left_in,R.anim.slide_right_out);
            break;
        case SLIDE_FROM_RIGHT_TO_LEFT:
            transaction.setCustomAnimations(R.anim.slide_right_in,R.anim.slide_left_out);
            break;
    }

    transaction.replace(R.id.findpwd_main_frame, fragment);
    transaction.commit();

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {}
    }, 200);
}
 
开发者ID:838030195,项目名称:DaiGo,代码行数:29,代码来源:FragmentResetPassword.java

示例3: showHideFragment

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
public static void showHideFragment(FragmentManager manager, Fragment show, Fragment hide, boolean animation, boolean backStack) {
    FragmentTransaction transaction = manager.beginTransaction();
    if (animation) {
        transaction.setCustomAnimations(
                R.anim .fragment_translate_in, R.anim.fragment_translate_out
        ,R.anim.fragment_pop_in,R.anim.fragment_pop_out);
    }
    transaction.show(show);
    if (hide == null) {
        List<Fragment> fragments = manager.getFragments();
        if (fragments != null) {
            for (Fragment fragment : fragments) {
                if (fragment != show) {
                    transaction.hide(fragment);
                }
            }
        }
    } else {
        transaction.hide(hide);
    }
    if (backStack) {
        transaction.addToBackStack("showHideFragment");
    }
    transaction.commit();
}
 
开发者ID:bigjelly,项目名称:ShaddockVideoPlayer,代码行数:26,代码来源:FragmentUtils.java

示例4: replaceCurrentFragment

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
public void replaceCurrentFragment(int container, Fragment targetFragment,
                                   String tag, boolean addToBackStack, boolean animate) {
    if (!isFinishing()) {
        FragmentManager manager = getSupportFragmentManager();
        boolean fragmentPopped = manager.popBackStackImmediate(tag, 0);

        if (!fragmentPopped && manager.findFragmentByTag(tag) == null) {
            FragmentTransaction ft = manager.beginTransaction();
            if (animate)
                ft.setCustomAnimations(R.anim.slide_out_right,
                        R.anim.slide_in_left, R.anim.slide_out_left,
                        R.anim.slide_in_right);
            ft.replace(container, targetFragment, tag);
            if (addToBackStack) {
                ft.addToBackStack(tag);
            }
            ft.commit();
        }
    }
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:21,代码来源:MainActivity.java

示例5: showAPIDrawer

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
 *  Toggle API drawer
 */
public void showAPIDrawer(boolean b) {

    FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
    ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_out_left,
            R.anim.slide_out_left);

    if (b) {
        webviewFragment = new APIWebviewFragment();
        Bundle bundle = new Bundle();
        bundle.putString("url", "http://localhost:8585/reference.html");
        webviewFragment.setArguments(bundle);
        ft.add(R.id.fragmentWebview, webviewFragment).addToBackStack(null);

        editorFragment.getView().animate().translationX(-50).setDuration(500).start();
    } else {
        editorFragment.getView().animate().translationX(0).setDuration(500).start();
        ft.remove(webviewFragment);
    }

    ft.commit();
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:25,代码来源:EditorActivity.java

示例6: onClick

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@Override
public void onClick(SwitcherButtonState state) {
	FragmentTransaction ft = getSupportFragmentManager()
			.beginTransaction();
	ft.setCustomAnimations(R.anim.fragment_fadein,
			R.anim.fragment_fadeout);
	switch (state) {
	case LEFT:
		//mHeaderLayout.init(HeaderStyle.TITLE_NEARBY_PEOPLE);
		ft.replace(R.id.publish_layout_content, mPublishFragment)
				.commit();
		break;

	case RIGHT:
		//mHeaderLayout.init(HeaderStyle.TITLE_NEARBY_GROUP);
		ft.replace(R.id.publish_layout_content, mHelperFragment).commit();
		break;
	}
}
 
开发者ID:qizhenghao,项目名称:HiBangClient,代码行数:20,代码来源:PublishActivity.java

示例7: showFragment

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@Override
public void showFragment(@NonNull MainFragment fragment, int oldTabIndex, int newTabIndex) {
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    if (newTabIndex > oldTabIndex)
        transaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left);
    else if (newTabIndex < oldTabIndex)
        transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right);
    transaction.replace(R.id.content, fragment);
    transaction.commit();
}
 
开发者ID:schul-cloud,项目名称:schulcloud-mobile-android,代码行数:11,代码来源:MainActivity.java

示例8: inflateDetailsFragment

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void inflateDetailsFragment(String packageName) {
    AurPackageDetailsFragment aurPackageDetailsFragment = AurPackageDetailsFragment.newInstance(packageName);
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.setCustomAnimations(R.anim.fragment_enter,
            R.anim.fragment_exit,
            R.anim.fragment_pop_enter,
            R.anim.fragment_pop_exit);
    fragmentTransaction.replace(R.id.main_fragment_container, aurPackageDetailsFragment, AUR_PACKAGE_DETAILS_FRAGMENT_TAG);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commit();
}
 
开发者ID:rascarlo,项目名称:AURdroid,代码行数:12,代码来源:MainActivity.java

示例9: onClickMomentPhotos

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@OnClick(R.id.rl_momentphotos)
void onClickMomentPhotos() {
    rlPhotosIcon.setImageResource(R.drawable.ic_photo_normal);
    rlMomentPhotosIcon.setImageResource(R.drawable.ic_moment_activated);
    rlAlbumsIcon.setImageResource(R.drawable.ic_album_normal);
    rlAssistantIcon.setImageResource(R.drawable.ic_assistant_normal);
    clearFragmentStack();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.setCustomAnimations(R.anim.fragment_enter, R.anim.fragment_exit);
    momentsFragment.what = ContentType.MOMENT_PHOTO.ordinal();
    transaction.replace(R.id.container, momentsFragment).commit();
    changeMenu(FragmentType.MOMENTS);
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:14,代码来源:MainActivity.java

示例10: onClickAlbums

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
@OnClick(R.id.rl_albums)
void onClickAlbums() {
    rlPhotosIcon.setImageResource(R.drawable.ic_photo_normal);
    rlMomentPhotosIcon.setImageResource(R.drawable.ic_moment_normal);
    rlAlbumsIcon.setImageResource(R.drawable.ic_album_activated);
    rlAssistantIcon.setImageResource(R.drawable.ic_assistant_normal);
    clearFragmentStack();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.setCustomAnimations(R.anim.fragment_enter, R.anim.fragment_exit);
    transaction.replace(R.id.container, albumsFragment).commit();
    changeMenu(FragmentType.ALBUMS);
}
 
开发者ID:aliyun,项目名称:aliyun-cloudphotos-android-demo,代码行数:13,代码来源:MainActivity.java

示例11: addFragmentToActivity

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
 * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
 * performed by the {@code fragmentManager}.
 */

public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager,
                                         @NonNull Fragment fragment, int frameId, String tag, int enterAnimation, int exitAnimation,
                                         int popEnter, int popExit) {

    checkNotNull(fragmentManager);
    checkNotNull(fragment);

    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.setCustomAnimations(enterAnimation, exitAnimation, popEnter, popExit);
    fragmentTransaction.replace(frameId, fragment, tag);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commitAllowingStateLoss();
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:19,代码来源:ActivityUtils.java

示例12: inflateDialogFragment

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void inflateDialogFragment(String title, String message) {
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.setCustomAnimations(R.anim.fragment_enter,
            R.anim.fragment_exit,
            R.anim.fragment_pop_enter,
            R.anim.fragment_pop_exit);
    Fragment fragmentByTag = fragmentManager.findFragmentByTag(AUR_DIALOG_FRAGMENT_TAG);
    if (fragmentByTag != null) {
        fragmentTransaction.remove(fragmentByTag);
    }
    fragmentTransaction.addToBackStack(null);
    AurDroidDialogFragment aurDroidDialogFragment = AurDroidDialogFragment.newInstance(title, message);
    aurDroidDialogFragment.show(fragmentTransaction, AUR_DIALOG_FRAGMENT_TAG);
}
 
开发者ID:rascarlo,项目名称:AURdroid,代码行数:15,代码来源:MainActivity.java

示例13: onClicked

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
/**
 *
 * @param index
 * @param boomButton
 */
@Override
public void onClicked(int index, BoomButton boomButton) {
    DialogFragment newContent = null;

    switch (index) {
        case MainActivity.SEND_BOOM_INDEX:
            newContent = new SendFragment();
            break;

        case MainActivity.RECEIVE_BOOM_INDEX:
            if (_mainAct.getLastSyncedMessage() == null) return;

            List<String> addrs = _mainAct.getLastSyncedMessage().getAddresses();
            if (addrs.size() > 0) {
                String lastAddr = addrs.get(addrs.size() - 1);
                newContent = new ReceiveFragment();

                Bundle receiveData = new Bundle();
                receiveData.putString(ReceiveFragment.DATA_KEY_ADDR, lastAddr);
                newContent.setArguments(receiveData);
            }
            break;

        default:
            break;
    }

    FragmentTransaction ft = _mainAct.getSupportFragmentManager().beginTransaction();
    ft.setCustomAnimations(R.anim.fade_in, R.anim.fade_out);
    ft.replace(R.id.xwallet_content_layout, newContent);
    ft.commit();
}
 
开发者ID:ehanoc,项目名称:xwallet,代码行数:38,代码来源:MainBoomListener.java

示例14: replaceFragment

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private void replaceFragment(Fragment fragment) {
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.setCustomAnimations(
            R.anim.slide_in_right,
            R.anim.slide_out_left,
            android.R.anim.slide_in_left,
            android.R.anim.slide_out_right);
    transaction.replace(R.id.fragment_container, fragment);
    transaction.addToBackStack(null);
    transaction.commit();
}
 
开发者ID:djuelg,项目名称:Neuronizer,代码行数:12,代码来源:MainActivity.java

示例15: createTransaction

import android.support.v4.app.FragmentTransaction; //导入方法依赖的package包/类
private FragmentTransaction createTransaction(@NonNull FragmentManager fragmentManager) {
    if (parameters != null && !parameters.isEmpty()) {
        fragment.setArguments(parameters);
    }

    FragmentTransaction transaction = fragmentManager.beginTransaction();

    if (addToBackStack) {
        transaction.addToBackStack(fragment.getClass().getSimpleName());
    }

    if (!sharedElement.isEmpty() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        for (View element : sharedElement) {
            transaction.addSharedElement(element, element.getTransitionName());
        }

    }

    if (animation != null) {
        transaction.setCustomAnimations(animation.getEnter(),
                                        animation.getExit(),
                                        animation.getPopEnter(),
                                        animation.getPopExit());
    }

    return transaction;
}
 
开发者ID:interactiveservices,项目名称:utils-android,代码行数:29,代码来源:FragmentBuilder.java


注:本文中的android.support.v4.app.FragmentTransaction.setCustomAnimations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。