티스토리 뷰

    final TextView mSwitcher = (TextView) findViewById(R.id.bookContent); mSwitcher.setText("old text");

   
final Animation in = new AlphaAnimation(0.0f, 1.0f);
   
in.setDuration(3000);

   
final Animation out = new AlphaAnimation(1.0f, 0.0f);
   
out.setDuration(3000);

   
Button moveOn = (Button) findViewById(R.id.moveOn);
    moveOn
.setOnClickListener( new OnClickListener() {
       
public void onClick(View v) {

            mSwitcher
.startAnimation(out);
            mSwitcher
.setText("new text");
            mSwitcher
.startAnimation(in);

       
}
   
});

 

 

 

==> 수정

 

out.setAnimationListener(new AnimationListener() {

    @Override
    public void onAnimationEnd(Animation animation) {
        mSwitcher.setText("New Text");
        mSwitcher.startAnimation(in);

    }
});

Then, in your onClick() method:

public void onClick(View v) {

    mSwitcher.startAnimation(out);

}
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
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
글 보관함