Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void myfun1()
- {
- int[] dest = new int[2];
- linearTop=(ImageView)findViewById(R.id.redDot);
- lineardown = (ImageView) findViewById(R.id.circlarea);
- linearFingerPlacedown.getLocationOnScreen(dest);
- final float tempDest = (float) dest[1];
- TranslateAnimation anim = new TranslateAnimation(0f, 0f, 0,tempDest
- );
- anim.setInterpolator(new LinearInterpolator());
- anim.setRepeatCount(Animation.ABSOLUTE);
- anim.setDuration(2000);
- linearTop.startAnimation(anim);
- final TranslateAnimation Reverse = new TranslateAnimation(0f, 0f,
- tempDest , 0);
- Reverse.setInterpolator(new LinearInterpolator());
- Reverse.setRepeatCount(Animation.ABSOLUTE);
- Reverse.setDuration(2000);
- anim.setAnimationListener(new AnimationListener()
- {
- @Override
- public void onAnimationStart(Animation animation)
- {
- }
- @Override
- public void onAnimationRepeat(Animation animation)
- {
- }
- @Override
- public void onAnimationEnd(Animation animation)
- {
- settingplace();
- linearTop.startAnimation(Reverse);
- }
- });
- }
- ==============
- public void settingplace()
- {
- System.out.println("place1:" + place);
- System.out.println("dp:" + dp);
- System.out.println("count:" + count);
- if ( count %2==0 && count < 10)
- {
- ImageView reddot=(ImageView)findViewById(R.id.redDot);
- LinearLayout.LayoutParams lp =(LinearLayout.LayoutParams) reddot.getLayoutParams();
- lp.setMargins(0, (int) (place), 0, 0);
- reddot.setLayoutParams(lp);
- place = (int) (place + (40 * dp));
- }
- }
Add Comment
Please, Sign In to add comment