2015-07-22 92 views

回答

5

您需要添加在你的應用程序模塊/build.gradle(或任何你需要使用旁路)的依賴。

例如:compile 'com.commit451:bypasses:1.0.1'

之後,你可以開始在代碼中使用這個庫。

你有一個使用例子here

TextView text = (TextView) findViewById(R.id.demoText); 
Bypass bypass = new Bypass(); 
String markdownString = "#Markdown!"; 
CharSequence string = bypass.markdownToSpannable(markdownString); 
text.setText(string); 
text.setMovementMethod(LinkMovementMethod.getInstance()); 
+0

我如何處理點擊鏈接事件? –

+0

您可以一起使用SpannableStringBuilder,URLSpan和ClickableSpan,然後將此結果SpannableStringBuilder設置爲TextView。 @AmrBarakat –