2.You see on photo.
linear1.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View p1, MotionEvent p2){
switch(p2.getAction()) {
case MotionEvent.ACTION_DOWN:
y1 = p2.getY();
x1 = p2.getX();
break;
case MotionEvent.ACTION_UP:
y2 = p2.getY();
x2 = p2.getX();
if (((x1 - x2) < -250)) {
Intent intent = new Intent(MainActivity.this, TutorialActivity.class); MainActivity.this.startActivity(intent);
}
if (((x2 - x1) < -250)) {
Intent intent = new Intent(MainActivity.this, TutorialActivity.class); MainActivity.this.startActivity(intent);
}
break;
}
return true;
}});
//Create Number Variable y1, y2, x1, x2
................................................................
Code 2 #Add source directly code
ObjectAnimator anim = ObjectAnimator.ofFloat(text, "Alpha", 0, 1);
anim.setDuration(500);
anim.start();
................................................................
3. Save and run this app.
No comments:
Post a Comment