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


Java ViewCompat.getTransitionName方法代码示例

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


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

示例1: onClick

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void onClick(View view) {
        Intent intent = new Intent(this, SharedElementSecondActivity.class);

//        startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(this, firstSharedView, "sharedView").toBundle());

        /* 要实现这种共享元素的过渡,那么就需要在两个布局对应的 view 中指定相同的 android:transitionName=""
        * 有多个 View 需要过渡就需要用到 Pair 来将 view 和 transitionName 对应起来
        * */
        Pair first = new Pair<>(mFirstSharedView, ViewCompat.getTransitionName(mFirstSharedView));
        Pair second = new Pair<>(mSecondSharedView, ViewCompat.getTransitionName(mSecondSharedView));

        ActivityOptionsCompat transitionActivityOptions =
                ActivityOptionsCompat.makeSceneTransitionAnimation(
                        this, first, second);

        ActivityCompat.startActivity(this,
                intent, transitionActivityOptions.toBundle());
    }
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:19,代码来源:SharedElementActivity.java

示例2: launch

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public static void launch(AppCompatActivity activity, View transitionView, int resId) {
//        Intent intent = new Intent(activity, ViewerActivity.class);
//
//
//        ActivityOptionsCompat options = ActivityOptionsCompat
//                .makeSceneTransitionAnimation(activity, transitionView, "image");
//
//        ActivityCompat.startActivity(activity, intent, options.toBundle());


        Pair squareParticipant = new Pair<>(transitionView, ViewCompat.getTransitionName(transitionView));
        ActivityOptionsCompat transitionActivityOptions =
                ActivityOptionsCompat.makeSceneTransitionAnimation(
                        activity, squareParticipant);
        Intent intent = new Intent(
                activity, ViewerActivity.class);
        intent.putExtra("resId", resId);
        activity.startActivity(intent, transitionActivityOptions.toBundle());
    }
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:20,代码来源:ViewerActivity.java

示例3: launch

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void launch(AppCompatActivity activity, View transitionView, int resId) {


        Pair squareParticipant = new Pair<>(transitionView, ViewCompat.getTransitionName(transitionView));
        ActivityOptionsCompat transitionActivityOptions =
                ActivityOptionsCompat.makeSceneTransitionAnimation(
                        activity, squareParticipant);
        Intent intent = new Intent(
                activity, ViewerActivity.class);
        intent.putExtra("resId", resId);
        startActivity(intent, transitionActivityOptions.toBundle());
    }
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:13,代码来源:ShareTractionActivity.java

示例4: onMapSharedElements

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
    if (!mSharedElementViews.isEmpty()) {
        removeObsoleteElements(names, sharedElements, mapObsoleteElements(names));
        for (View sharedElementView : mSharedElementViews) {
            String transitionName = ViewCompat.getTransitionName(sharedElementView);
            names.add(transitionName);
            sharedElements.put(transitionName, sharedElementView);
        }
    }
}
 
开发者ID:Nulltilus,项目名称:Appmatic-Android,代码行数:12,代码来源:GallerySharedElementCallback.java

示例5: create

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public static DetailsKey create(Pair<View, String> sharedElement, @IntRange(from = 1, to = 6) int kittenNumber) {
    DetailsKey detailsKey = new AutoValue_DetailsKey(ViewCompat.getTransitionName(sharedElement.first), kittenNumber);
    detailsKey.sharedElement = Pair.create(new WeakReference<>(sharedElement.first),
            sharedElement.second); // see https://github.com/google/auto/blob/4016d8dbbe4de668a1849e95223d1f2447b647bc/value/userguide/howto.md#ignore
    return detailsKey;
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:7,代码来源:DetailsKey.java

示例6: startSharedTransitionActivity

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * Starts a shared transition of activities connected by views
 * <br/>
 *
 * @param base The calling activity
 * @param target The view from the calling activity with transition name
 * @param data Intent with bundle and or activity to start
 */
public static void startSharedTransitionActivity(Activity base, View target, Intent data) {
    Pair participants = new Pair<>(target, ViewCompat.getTransitionName(target));
    ActivityOptionsCompat transitionActivityOptions =
            ActivityOptionsCompat.makeSceneTransitionAnimation(
                    base, participants);
    ActivityCompat.startActivity(base, data, transitionActivityOptions.toBundle());
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:16,代码来源:TransitionHelper.java


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