Widget - Layout Animation Slide

//Create Linear1

//Add Linear2 to Linear1

//OnCreate
linear2.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View p1, MotionEvent p2) {
switch(p2.getAction()) {
case MotionEvent.ACTION_DOWN:
f = p2.getY();
break;
case MotionEvent.ACTION_UP:
t = p2.getY();
if (((f - t) < -250)) {
_slideDown();
}
if (((t - f) < -250)) {
_slideUp();
}
break;
}
return true;
}});

//_slideDown
ObjectAnimator animX = ObjectAnimator.ofFloat(linear2, "x", 300f);
ObjectAnimator animY = ObjectAnimator.ofFloat(linear2, "y", 700f);
AnimatorSet animSetXY = new AnimatorSet();
animSetXY.playTogether(animX, animY);
animSetXY.start();


//_slideUp
ObjectAnimator animX = ObjectAnimator.ofFloat(linear2, "x", 0f);
ObjectAnimator animY = ObjectAnimator.ofFloat(linear2, "y", 0f);
AnimatorSet animSetXY = new AnimatorSet();
animSetXY.playTogether(animX, animY);
animSetXY.start();

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

TextInputLayout in Sketchware

How to find and​ highlight a word in a text field in Sketchware?

A Flash Light App in Sketchware

How to enable download in webview in Sketchware apps?

Intent - Open File By Type

Code for implementing Notifications in Sketchware

How to share an image from Drawable folder?

ActionBar back button

Animation Transtition Animation