=================================
=================================
=================================
출처: http://blog.naver.com/PostView.nhn?blogId=gh2501&logNo=127624029
package com.example;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.LinearLayout;
import android.widget.TextView;
public class BlinkTextTest extends Activity{
TextView selection;
boolean hasFocus;
public void onCreate(Bundle icicle){
super.onCreate(icicle);
setContentView(R.layout.simple_main);
selection = (TextView)findViewById(R.id.selection); //터치이벤트를 받을 텍스트뷰로 이곳의 텍스트 색깔을 바꾼다.
selection.setOnTouchListener(new OnTouchListener(){ //터치 이벤트 리스너 등록(누를때와 뗐을때를 구분)
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
if(event.getAction()==MotionEvent.ACTION_DOWN){
if(selection.getClass()==v.getClass()){
selection.setTextColor(Color.WHITE);
}
}
if(event.getAction()==MotionEvent.ACTION_UP){
if(selection.getClass()==v.getClass()){
selection.setTextColor(Color.BLACK);
}
}
return true;
}
});
}
}
=================================
=================================
=================================
댓글 영역