Code example for SpannableString

Methods: setSpan

0
		makeTextViewFakeLink(tv, onClickListener, android.R.drawable.list_selector_background); 
	} 
	 
	public static void makeTextViewFakeLink(TextView tv, final View.OnClickListener onClickListener, int selectorBgResId) { 
		String text = tv.getText().toString(); 
		SpannableString spanString = new SpannableString(text); 
		ClickableSpan clickSpan = new ClickableSpan() { 
			 
			@Override 
			public void onClick(View widget) { 
//				onClickListener.onClick(widget); 
			} 
		}; 
		spanString.setSpan(clickSpan, 0, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); 
		 
		tv.setLinksClickable(false); 
		tv.setMovementMethod(LinkMovementMethod.getInstance()); 
		tv.setBackgroundResource(selectorBgResId); 
		tv.setText(spanString); 
		tv.setOnClickListener(onClickListener); 
	}