本文整理了Java中android.widget.TextView.setAnimation()
方法的一些代码示例,展示了TextView.setAnimation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setAnimation()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setAnimation
暂无
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: stackoverflow.com
TextView text = (TextView)findViewById(R.id.txtview);
text.setText("rotated text here");
RotateAnimation rotate= (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.rotateAnimation);
text.setAnimation(rotate);
代码示例来源:origin: stackoverflow.com
mAnimation.setRepeatMode(Animation.RESTART);
mAnimation.setRepeatCount(Animation.INFINITE);
view.setAnimation(mAnimation);
parent_layout.addView(view);
代码示例来源:origin: stackoverflow.com
TextView text = (TextView)findViewById(R.id.txtview);
text.setText("rotated text here");
RotateAnimation rotate= (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.rotateAnimation);
text.setAnimation(rotate);
代码示例来源:origin: stackoverflow.com
Animation anim=AnimationUtils.loadInterpolator(this,R.anim.xmlfile);
TextView txt=new TextView(this);
txt.setAnimation(anim);
代码示例来源:origin: stackoverflow.com
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 .....
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: stackoverflow.com
@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);
}
代码示例来源:origin: stackoverflow.com
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();
}
});
代码示例来源:origin: stackoverflow.com
};
myTread.start();
splashText.setAnimation(alpha);
代码示例来源:origin: stackoverflow.com
txt.setAnimation(animation);
代码示例来源:origin: lltvcn/FreeText
@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();
}
}
}
代码示例来源:origin: lltvcn/FreeText
@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();
}
}
代码示例来源:origin: googlesamples/android-RecipeAssistant
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);
代码示例来源:origin: stackoverflow.com
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();
代码示例来源:origin: stackoverflow.com
if((texts.length-1) != textIndex) animation.addAnimation(fadeOut);
animation.setRepeatCount(1);
textView.setAnimation(animation);
代码示例来源:origin: stackoverflow.com
blink = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.blink);
loading_txt.setAnimation(blink);
Begin();
代码示例来源:origin: lltvcn/FreeText
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);
}
代码示例来源:origin: lltvcn/FreeText
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);
}
内容来源于网络,如有侵权,请联系作者删除!