안드로이드 TextView 특정 문자열 클릭 이벤트 주기...

Spannable span = Spannable.Factory.getInstance().newSpannable("click");
String text = span.toString();          
int start = text.indexOf("click");        
int end = start + "click".length();         
span.setSpan(new ClickableSpan() {            
    @Override            
    public void onClick(View widget) { 
    }             
    
    @Override             
    public void updateDrawState(TextPaint ds) {  
        ds.linkColor = 0xff000000;             
        super.updateDrawState(ds);           
    }         
}, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE);   

view.setText(span);        
view.setHighlightColor(Color.TRANSPARENT);         
view.setMovementMethod(LinkMovementMethod.getInstance());

댓글