本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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);
}
}
}
示例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;
}
示例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());
}