本文整理匯總了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;
}