티스토리 뷰

AlphaAnimation alphaDown,alphaUp;
 
_button = (Button)findViewById(R.id.button1);
//set animation
alphaDown = new AlphaAnimation(1.0f, 0.5f);
alphaUp = new AlphaAnimation(0.5f, 1.0f);
alphaDown.setDuration(100);
alphaUp.setDuration(100);
alphaDown.setFillAfter(true);
alphaUp.setFillAfter(true);
 
//set OnTouchListener
_button.setOnTouchListener(new View.OnTouchListener() {
   @Override
   public boolean onTouch(View v, MotionEvent event) {
   // TODO Auto-generated method stub
    if(event.getAction()==MotionEvent.ACTION_DOWN)
        _button.startAnimation(alphaDown);
    if(event.getAction()==MotionEvent.ACTION_UP)
        _button.startAnimation(alphaUp);
    return false;
     }
});



http://hasithdevs.wordpress.com/category/android-2/

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