2013-08-19 5 views
0

내가 각 단어가이 코드안드로이드 하이퍼 링크 텍스트 형식을 제거하는 방법?

private ClickableSpan getClickableSpan() { 
    return new ClickableSpan() { 
     @Override 
     public void onClick(View widget) { 
      TextView tv = (TextView) widget; 
      String s = tv 
        .getText() 
        .subSequence(tv.getSelectionStart(), 
          tv.getSelectionEnd()).toString(); 

      Log.d("tapped on:", s); 
     } 

     public void updateDrawState(TextPaint ds) { 
      super.updateDrawState(ds); 
     } 
    }; 
} 

public static Integer[] getIndices(String s, char c) { 
    int pos = s.indexOf(c, 0); 
    List<Integer> indices = new ArrayList<Integer>(); 
    while (pos != -1) { 
     indices.add(pos); 
     pos = s.indexOf(c, pos + 1); 
    } 

    pos = s.indexOf("\n", 0); 
    while (pos != -1) { 
     indices.add(pos); 
     pos = s.indexOf("\n", pos + 1); 
    } 

    Collections.sort(indices); 

    return (Integer[]) indices.toArray(new Integer[0]); 
} 
을 사용하여 클릭 가능한 내 텍스트 뷰를 사용

문제가 내가 HTML.fromHtml를 사용하여 글꼴 색상을 설정할 수있다(); 내가 때 클릭 하이퍼 링크 색상 난, 파란색 상자를 하이퍼 링크 텍스트 형식을

파란색 글꼴 색상을 제거 강조 할 블루

을 변경할 수 있습니다이 하이퍼 링크 코드를 사용할 때

하지만

답변

0

내가 내 문제를 해결 NoURLUnderline이 작동하지 않는되도록 내가 ClickableSpan를 사용 :

이 코드

public class NonUnderlinedClickableSpan extends ClickableSpan 
{ 
    @Override 
     public void updateDrawState(TextPaint ds) {    
      ds.setUnderlineText(false); // set to false to remove underline 
     } 

    @Override 
    public void onClick(View widget) { 
     // TODO Auto-generated method stub 
    } 
} 

를 사용

+0

언더 라인을 유지하면서 파란 색을 제거하려면 어떻게해야합니까? – jonney

관련 문제