티스토리 뷰
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);
}
});
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);
}
'개발 > 개발 자료' 카테고리의 다른 글
(Android) 커스텀 타이틀바 (Custom TitleBar) 만들기 (0) | 2015.03.27 |
---|---|
(JSP) Could not open the editor: An unexpected exception was thrown (0) | 2015.03.20 |
(Android) Intent로 Bitmap 넘기기 (4) | 2015.02.11 |
(Android) Content Add/Insert (0) | 2015.02.04 |
(.NET) 배포버전 (Release 버전) EXE파일 만들기 (0) | 2015.02.04 |
댓글