本文整理汇总了Java中android.transition.Slide.setSlideEdge方法的典型用法代码示例。如果您正苦于以下问题:Java Slide.setSlideEdge方法的具体用法?Java Slide.setSlideEdge怎么用?Java Slide.setSlideEdge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.transition.Slide
的用法示例。
在下文中一共展示了Slide.setSlideEdge方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.transition.Slide; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
super.onCreate(savedInstanceState);
Slide slideIn = new Slide();
slideIn.setDuration(500);
//设置为进入
slideIn.setMode(Visibility.MODE_IN);
//设置从右边进入
slideIn.setSlideEdge(Gravity.RIGHT);
getWindow().setEnterTransition(new ChangeImageTransform().setDuration(3000));
// getWindow().setEnterTransition(new Explode().setDuration(2000));
// getWindow().setExitTransition(new Explode().setDuration(2000));
Slide slideReturn =new Slide();
slideReturn.setDuration(500);
slideReturn.setSlideEdge(Gravity.LEFT);
slideReturn.setMode(Visibility.MODE_OUT);
getWindow().setReturnTransition (slideReturn );
setContentView(R.layout.activity_img_transition);
mImageView = (ImageView) findViewById(R.id.img);
// Transition sharedElementEnterTransition = getWindow().getSharedElementEnterTransition();
}
示例2: setupSlideTransition
import android.transition.Slide; //导入方法依赖的package包/类
private void setupSlideTransition() {
Slide slideEnter = new Slide();
slideEnter.setSlideEdge(Gravity.LEFT);
slideEnter.setDuration(500);
slideEnter.setStartDelay(250);
slideEnter.excludeTarget(android.R.id.navigationBarBackground, true);
slideEnter.excludeTarget(android.R.id.statusBarBackground, true);
getWindow().setEnterTransition(slideEnter);
Slide slideOut = new Slide();
slideOut.setSlideEdge(Gravity.RIGHT);
slideOut.setDuration(500);
slideOut.setStartDelay(0);
slideOut.excludeTarget(android.R.id.navigationBarBackground, true);
slideOut.excludeTarget(android.R.id.statusBarBackground, true);
getWindow().setExitTransition(slideOut);
}
示例3: setupSlideTransition
import android.transition.Slide; //导入方法依赖的package包/类
private void setupSlideTransition() {
Slide slideEnter = new Slide();
slideEnter.addTarget(R.id.text_card);
slideEnter.setDuration(1000);
slideEnter.setStartDelay(500);
slideEnter.setSlideEdge(Gravity.RIGHT);
slideEnter.excludeTarget(android.R.id.navigationBarBackground, true);
slideEnter.excludeTarget(android.R.id.statusBarBackground, true);
getWindow().setEnterTransition(slideEnter);
// Tips: Cann't set same Transition object to more than one Transition callbacks.
// getWindow().setReenterTransition(slideEnter);
Slide slideOut = new Slide();
slideOut.addTarget(R.id.text_card);
slideOut.setDuration(500);
slideOut.setSlideEdge(Gravity.RIGHT);
slideOut.excludeTarget(android.R.id.navigationBarBackground, true);
slideOut.excludeTarget(android.R.id.statusBarBackground, true);
getWindow().setExitTransition(slideOut);
}
示例4: click
import android.transition.Slide; //导入方法依赖的package包/类
public void click(View view) {
/*
* Slide: this transition tracks changes to the visibility of target views
* in the start and end scenes and moves views in or out
* from one of the edges of the scene.
*/
Slide slide = new Slide();
// Change the edge that Views appear and disappear from.
slide.setSlideEdge(Gravity.TOP);
ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
/*
* beginDelayedTransition: Convenience method to animate to a new scene
* defined by all changes within the given scene root
* between calling this method and the next rendering frame.
*/
TransitionManager.beginDelayedTransition(root, slide);
imageView.setVisibility(View.INVISIBLE);
}
示例5: loadFragment
import android.transition.Slide; //导入方法依赖的package包/类
private void loadFragment(Fragment fragment, Boolean addToBackState) {
String tag = fragment.getClass().getCanonicalName();
if (fragmentManager.findFragmentByTag(tag) != null && savedInstance != null) {
fragmentManager.popBackStack(tag, FragmentManager.POP_BACK_STACK_INCLUSIVE);
fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
if (savedInstance == null) {
Log.i(TAG, "Fragment Loaded (" + tag + ")");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Slide slideIn = new Slide();
slideIn.setSlideEdge(Gravity.RIGHT);
fragment.setEnterTransition(slideIn);
Slide slideOut = new Slide();
slideOut.setSlideEdge(Gravity.LEFT);
fragment.setExitTransition(slideOut);
}
FragmentTransaction tran = fragmentManager.beginTransaction()
.replace(R.id.fragment_container, fragment, tag);
if (addToBackState)
tran.addToBackStack(tag);
tran.commitAllowingStateLoss();
}
}
示例6: setupWindowAnimations
import android.transition.Slide; //导入方法依赖的package包/类
private void setupWindowAnimations() {
// Re-enter transition is executed when returning to this activity
Slide slideTransition = new Slide();
slideTransition.setSlideEdge(Gravity.LEFT);
slideTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
getWindow().setReenterTransition(slideTransition);
getWindow().setExitTransition(slideTransition);
}
示例7: onInit
import android.transition.Slide; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onInit(Bundle savedInstanceState) {
Slide slide = new Slide();
slide.setSlideEdge(Gravity.LEFT);//滑出的方向
slide.setInterpolator(new DecelerateInterpolator());
slide.setDuration(500);//动画持续时间
getWindow().setExitTransition(slide);
// init your data and call mLoadingAndRetryManager.xxx to control the view show and gone
loadData();
ContextCompat.getColor(this, R.color.colorPrimary);
}
示例8: buildEnterTransition
import android.transition.Slide; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected Visibility buildEnterTransition() {
Slide enterTransition = new Slide();
enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
enterTransition.setSlideEdge(Gravity.RIGHT); //从右边滑动进入
return enterTransition;
}
示例9: buildEnterTransition
import android.transition.Slide; //导入方法依赖的package包/类
private Visibility buildEnterTransition() {
Slide enterTransition = new Slide();
enterTransition.setDuration(getResources().getInteger(R.integer.anim_duration_long));
enterTransition.setSlideEdge(Gravity.RIGHT);
return enterTransition;
}