TextView t = (TextView)findViewById(R.id.txtview); String txt = "Stackoverflow"; t.setText(txt); RotateAnimation ranim = (RotateAnimation)AnimationUtils.loadAnimation(this, R.anim.myanim); ranim.setFillAfter(true); //For the textview to remain at the same place after the rotation t.setAnimation(ranim);
TextView text = (TextView)findViewById(R.id.txtview); text.setText("rotated text here"); RotateAnimation rotate= (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.rotateAnimation); text.setAnimation(rotate);
mAnimation.setRepeatMode(Animation.RESTART); mAnimation.setRepeatCount(Animation.INFINITE); view.setAnimation(mAnimation); parent_layout.addView(view);
TextView text = (TextView)findViewById(R.id.txtview); text.setText("rotated text here"); RotateAnimation rotate= (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.rotateAnimation); text.setAnimation(rotate);
Animation anim=AnimationUtils.loadInterpolator(this,R.anim.xmlfile); TextView txt=new TextView(this); txt.setAnimation(anim);
Animation mAnimation = new TranslateAnimation(START_POS_X, END_POS_X, START_POS_Y, END_POS_Y); mAnimation.setDuration(TICKER_DURATION); mAnimation.setRepeatMode(Animation.RESTART); mAnimation.setRepeatCount(Animation.INFINITE); TextView tvTitulo = new TextView(this); tvTitulo.setText("Some loooooooooooooooooooooong text"); tvTitulo.setAnimation(mAnimation); jUST CHECK this code .....
Animation animationToLeft = new TranslateAnimation(400, -400, 0, 0); animationToLeft.setDuration(12000); animationToLeft.setRepeatMode(Animation.RESTART); animationToLeft.setRepeatCount(Animation.INFINITE); Animation animationToRight = new TranslateAnimation(-400,400, 0, 0); animationToRight.setDuration(12000); animationToRight.setRepeatMode(Animation.RESTART); animationToRight.setRepeatCount(Animation.INFINITE); TextView textViewMarqToLeft = (TextView) findViewById(R.id.textViewMarqToLeft); TextView textViewMarqToRight = (TextView) findViewById(R.id.textViewMarqToRight); textViewMarqToLeft.setAnimation(animationToLeft); textViewMarqToRight.setAnimation(animationToRight); String textLeft = "Left marquue" String textRight = "Right marquue" textViewMarqToLeft.setText(textLeft); textViewMarqToRight.setText(textRight);
TextView tv = (TextView) findViewById(R.id.txt); Rect bounds = new Rect(); Paint textPaint = tv.getPaint(); String text = tv.getText().toString(); textPaint.getTextBounds(text, 0, text.length(), bounds); int width = bounds.width(); LinearLayout.LayoutParams lp = (LayoutParams) tv.getLayoutParams(); lp.width = width + 100; int startX = 300; TranslateAnimation ta = new TranslateAnimation(startX, lp.width, 0, 0); ta.setDuration(20000); ta.setRepeatCount(-1); tv.setAnimation(ta);
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Animation animationToLeft = new TranslateAnimation(400, -400, 0, 0); animationToLeft.setDuration(12000); animationToLeft.setRepeatMode(Animation.RESTART); animationToLeft.setRepeatCount(Animation.INFINITE); Animation animationToRight = new TranslateAnimation(-400,400, 0, 0); animationToRight.setDuration(12000); animationToRight.setRepeatMode(Animation.RESTART); animationToRight.setRepeatCount(Animation.INFINITE); TextView tv = (TextView) findViewById(R.id.TextView02); TextView tv1 = (TextView) findViewById(R.id.TextView03); tv.setAnimation(animationToLeft); tv1.setAnimation(animationToRight); String textLeft = "Really Long Scrolling Text Goes Here.... ..... ............ .... ...."; String textRight = "Testing"; tv.setText(textLeft); tv1.setText(textRight); }
final TextView yourTextView = (TextView)findViewById(R.id.yourTextView); final AlphaAnimation animateS = new AlphaAnimation(1,0); final AlphaAnimation animateF = new AlphaAnimation(0,1); animateS.setDuration(700); animateF.setDuration(700); animateS.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { yourTextView.setAnimation(animateF); animateF.start(); yourTextView.setText("New Text"); } @Override public void onAnimationRepeat(Animation animation) { } }); yourTextView.setText(str); yourTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { yourTextView.setAnimation(animateS); animateS.start(); } });
}; myTread.start(); splashText.setAnimation(alpha);
txt.setAnimation(animation);
@Override public void onAnimationEnd(Animation animation) { if(currentAnimation!=null){ boolean start = false; if(currentIndex == animations.size()-1){ repeatCount++; if(getRepeatCount() == INFINITE||repeatCount<=getRepeatCount()){ currentIndex = 0; start = true; }else{ start = false; repeatCount = 0; currentIndex = 0; currentAnimation = null; } }else if(currentIndex<animations.size()){ start = true; currentIndex++; } if(start){ currentAnimation = animations.get(currentIndex); tv.setAnimation(currentAnimation); currentAnimation.start(); } } }
@Override public void start() { if(currentAnimation!=null){ cancel(); tv.post(new Runnable() { @Override public void run() { start(); } }); return; } currentAnimation = animations.get(0); currentIndex = 0; repeatCount = 0; if(currentAnimation!=null){ tv.setAnimation(currentAnimation); currentAnimation.start(); } }
private void displayRecipe(Recipe recipe) { Animation fadeIn = AnimationUtils.loadAnimation(this, android.R.anim.fade_in); mTitleTextView.setAnimation(fadeIn); mTitleTextView.setText(recipe.titleText); mSummaryTextView.setText(recipe.summaryText);
a.setAnimationListener(fadeOutComplete); t.setText("helo world"); // <--- if i add this line the code suddenly works t.setAnimation(a); a.setAnimationListener(fadeOutComplete); t.setText("helo world"); // <--- if i add this line the code suddenly works t.setAnimation(a); finish();
if((texts.length-1) != textIndex) animation.addAnimation(fadeOut); animation.setRepeatCount(1); textView.setAnimation(animation);
blink = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.blink); loading_txt.setAnimation(blink); Begin();
private static TA createRoteteRepeat(TextView tv) { RotateAnimation animation = new RotateAnimation(-3,3, Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f); animation.setDuration(150); // animation.setInterpolator(new DecelerateInterpolator()); animation.setRepeatCount(Animation.INFINITE); animation.setRepeatMode(Animation.REVERSE); tv.setAnimation(animation); return new Animation2IA(animation); }
private static TA createScaleShow(TextView tv) { ScaleAnimation sa = new ScaleAnimation(4,1f,4,1f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f); sa.setStartOffset(500); sa.setDuration(600); sa.setRepeatCount(Animation.INFINITE); sa.setRepeatMode(Animation.RESTART); tv.setAnimation(sa); return new Animation2IA(sa); }