1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
@Override
public boolean onTouchEvent(MotionEvent event)
{
findViewById(R.id.jouer).setOnClickListener(
new Button.OnClickListener()
{
public void onClick(View v)
{
int y1 =randomAnimation() ;
int y2 = randomAnimation();
int x1 = randomAnimationHeight();
int x2 = randomAnimationHeight();
TranslateAnimation anim1= new TranslateAnimation(y1, y2,x1, x2);
anim1.setFillAfter(true);
anim1.setDuration(100);
findViewById(R.id.jouer).startAnimation(anim1);
findViewById(R.id.jouer).setVisibility(View.VISIBLE);
Log.i("", "y1 : "+y1);
Log.i("", "Y2 : "+y2);
Log.i("", "X1 : "+x1);
Log.i("", "X2 ; "+x2);
findViewById(R.id.jouer).setPadding(y1, y2, x1, x2);
Log.i("", "GetPaddingLeft "+findViewById(R.id.jouer).getPaddingLeft());
Log.i("", "getPaddingBottom "+findViewById(R.id.jouer).getPaddingBottom());
Log.i("", "getPaddingRight "+findViewById(R.id.jouer).getPaddingRight());
Log.i("", "getPaddingTop "+findViewById(R.id.jouer).getPaddingTop());
}
}
);
return super.onTouchEvent(event);
} |
Partager