當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。