0
我試圖在textview(駐留在listview中)中顯示JSON結果。其中一個結果是必須顯示爲「查看結果」的網址。我用下面的代碼顯示的URL爲「查看結果」:Html <a>標籤在Android中不起作用textview
String result = "<a href=\"" + jsonObject.get("url") + "\">" + getString(R.string.hyperlink_text) + "</a>" + "\n";
bbieResults.put("Result", Html.fromHtml(result));
的相關的XML佈局:
<TextView
android:id="@+id/list_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/list_label"
android:layout_marginLeft="10dp"
android:autoLink="web"
android:linksClickable="true"
android:textSize="25dp" />
這TextView的確實顯示「查看結果」作爲URL的標籤但我實際上無法點擊它。那麼我怎樣才能讓這個可點擊的超鏈接呢?
感謝提前:)
謝謝,我已經在另一項活動中測試了這一點,這確實是我正在尋找的。但是在這種特殊情況下,它會導致一個空指針異常。 textview位於由listview使用的自定義row.xml中。你能指出我在正確的方向,我將如何解決這個問題嗎? – Meatje 2012-02-21 16:09:59