linkify

Ruby linkify for urls in strings

一世执手 提交于 2019-12-09 12:07:58
问题 There have been a few posts about linkifying text using a regex. The most popular is this post. However my spec is a little more tricky: describe TextFormatter do def l(input) TextFormatter.gsub_links!(input){|link| "!!#{link}!!"} end it "should detect simple links" do l("http://www.cnn.com").should == "!!http://www.cnn.com!!" end it "should detect multi links" do l("http://www.cnn.com http://boats.com?help.asp").should == "!!http://www.cnn.com!! !!http://boats.com?help.asp!!" end it "should

Make Webview's auto links visible

南楼画角 提交于 2019-12-08 22:35:41
A Webview will display links in the content HTML as having blue underlines. So if you have something in the HTML like <a href="...">blah blah</a> ... it is clearly visible as a link. The Webview also allows you to click on phone numbers and addresses (even if those are just text in the HTML, not links) to launch the Dialer or Maps. How can one get Webview to display those (Linkify, probably) links with underlines etc? It's easy enough in a TextView since one can get the spans from a TextView and style them, but Webview doesn't expose any way to retrieve that data... at least not that I can see

Make Webview's auto links visible

梦想的初衷 提交于 2019-12-08 05:16:07
问题 A Webview will display links in the content HTML as having blue underlines. So if you have something in the HTML like <a href="...">blah blah</a> ... it is clearly visible as a link. The Webview also allows you to click on phone numbers and addresses (even if those are just text in the HTML, not links) to launch the Dialer or Maps. How can one get Webview to display those (Linkify, probably) links with underlines etc? It's easy enough in a TextView since one can get the spans from a TextView

Disable Automatic Linking of Mailing Address in WebView

梦想的初衷 提交于 2019-12-07 17:53:50
问题 The android WebView will automatically detect a mailing address in the html and allow you to click on it to launch a map. Is there anyway to disable this without a native code change? Can I add something to the html markup or cancel a javascript event to prevent this from happening? If I need to make this change in native code, how is that done? EDIT: When I say mailing address, I mean a physical street address, like: 123 Main Street Sometown, CA 12345 回答1: You might want to try using the

Android Linkify - Clickable telephone numbers

混江龙づ霸主 提交于 2019-12-07 07:41:36
问题 So I am trying to add the functionality that when you click on a phone number it would take you to the Dialer app with the pre-populated number. I have the code below: mContactDetailsText.setText(phonetextBuilder.toString()); Pattern pattern = Pattern.compile("[0-9]+\\s+[0-9]+"); Linkify.addLinks(mContactDetailsText, pattern, "tel:"); and the Text is currently "T. 0123 4567890" The current outcome is just having the above string without it being clickable. I have even tried added the

Android Make hyperlinks in textview clickable

こ雲淡風輕ζ 提交于 2019-12-06 13:55:45
I am getting some HTML from server and showing in Textview. The HTML have some hyperlinks. I want that when user clicks some hyperlink, it opens that link's url in device browser but it is not working. I have read about Linkify and using following: TextView articleDescription = (TextView)findViewById(R.id.articledescription); articleDescription.setText(Html.fromHtml(articleInfo.getArticle_body())); Linkify.addLinks(articleDescription, Linkify.WEB_URLS); but its too not working. Any idea...??? Sorry guys, actually I have recently noticed that the hyperlinks are relative to the server so I think

Disable Automatic Linking of Mailing Address in WebView

你。 提交于 2019-12-06 03:54:37
The android WebView will automatically detect a mailing address in the html and allow you to click on it to launch a map. Is there anyway to disable this without a native code change? Can I add something to the html markup or cancel a javascript event to prevent this from happening? If I need to make this change in native code, how is that done? EDIT: When I say mailing address, I mean a physical street address, like: 123 Main Street Sometown, CA 12345 You might want to try using the following meta tag in the page you're including in the WebView, if that's possible. <meta name="format

Android ExpandableListView with clickable links in child TextView won't expand when touching TextView

こ雲淡風輕ζ 提交于 2019-12-05 16:55:32
I have been searching for a solution to this issue which seems rather trivial. I have an ExpandableListView with various child elements, including a TextView. I would like links to be detected in the TextView, so I have tried using android:autoLink="web" and also Linkify.addLinks(textView, Linkify.WEB_URLS); Either will create hyperlinks in the TextView. The problem that I have encountered is that when there is a link in the TextView, the ExpandableListView item with a link will no longer expand when touching any elements within the item. I have added android:descendantFocusability=

Android Linkify - Clickable telephone numbers

自古美人都是妖i 提交于 2019-12-05 13:08:23
So I am trying to add the functionality that when you click on a phone number it would take you to the Dialer app with the pre-populated number. I have the code below: mContactDetailsText.setText(phonetextBuilder.toString()); Pattern pattern = Pattern.compile("[0-9]+\\s+[0-9]+"); Linkify.addLinks(mContactDetailsText, pattern, "tel:"); and the Text is currently "T. 0123 4567890" The current outcome is just having the above string without it being clickable. I have even tried added the following line, but to no luck: mContactDetailsText.setAutoLinkMask(0); Anyone got any ideas or can see what I

Android: Format Font in Alert Dialog

ε祈祈猫儿з 提交于 2019-12-05 00:47:44
问题 I have two questions 1) Does anyone know, how to apply styles or formatting to alert dialog. I currently use Builder builder = new AlertDialog.Builder(this); And use setMessage() method to set the content. 2) Also I would like to know how to change the color of the links created by linkify. I don't want the default blue color. 回答1: Q1. You have to inflate or customize and create a style and apply to AlertDialog Heres how you inflate a layout and apply it to AlertDialog LayoutInflater li =