如何自动链接:地图工作 [英] How does autolink:map work

查看:137
本文介绍了如何自动链接:地图工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的 antroid:自动链接=地图的TextView 的属性转至地图,找到与该关联TextView的地址

I am using antroid:autoLink="map" attribute of TextView to Go to map and find the address associated with that textview.

但它是stragely行为和发现只有一些地址即可。这里是code什么我想:

But its is behaving stragely and finding only some addresses. Here is the code what I am trying:

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
    <TextView
        android:id="@+id/textViewautoLink"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/autolinktext"
        android:autoLink="map"></TextView>
</LinearLayout>

下面是我的的strings.xml

strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="autolinktext">1600 Amphitheatre Parkway, Mountain View, CA 94043 </string>
</resources>

问题是:

假设我写上面的字符串即
1600剧场百汇,山景城,CA 94043
那么它的做工精细,并得到TextView的颜色蓝色,当我点击它身上它会搜索在地图上的地址。

Suppose I am writing the above string i.e. 1600 Amphitheatre Parkway, Mountain View, CA 94043 then its working fine and textView gets blue in colour and when I click onit it searches the address on Map.

在我这个地址更改为: 1600剧场百汇,孟买,IN
那么它也显示了同样的事情,并尝试搜索地址,但因为地址错了,它无法找到它。它的确定。

When I change this address to : 1600 Amphitheatre Parkway, Mumbai, IN then also it shows the same thing and tries to search the address but since the address is wrong it couldnt find it. Its OK.

但是,当我写的其他地址,如: 600带支架,孟买,IN
然后

But when I write other address like: 600 Band Stand, Mumbai, IN Then

1)在蓝色的心不是TextView的

1) the textview isnt in blue color

2),它似乎并不可点击

2) Its doesn't seem to be clickable

3),因为它是不可点击它没有找到该地址。

3) and since it is not clickable it doesn't find the address.

我搜索谷歌,但我没有得到任何理由的行为。
此外,我想知道,

I am searching google but am not getting any reason for this behaviour. Also I want to know that

有什么格式写这本地图的地址?

Is there any format for writing this map address?

还怎么安卓知道该地址是有效的,或只是不
  写入字符串的地址我已经写在同一个地址
  相同的格式只是改变了字符串,结果是一个
  地址是点击和其他没有。

Also how android knows that the address is valid or not by just writing the address in String as I have written the same address in the same format just changed the String and the result is that one address is clickable and other is not.

请帮助。

推荐答案

下面是评论从匹配拿起


  1. 找一个1 - 对于街道号码
  2. (对于'一个Microsoft方式不支持)5位数字
  3. 如果忽略$ P $按'​​#'pceded,套房,科技教育,RM

  4. 查找两个或多个单词(最多5?北弗兰克·劳埃德·赖特大道)结果
    注:在北山街的圆有六个字,和'在'较低的 - 在允许通过的,在的,而且,......?

  5. 如果一个词以小写字母开头,没有匹配结果
    允许:。 - #/(1/2)

  6. 的外观为一个或两个分隔符重新present可能第二地址线和城市名搜索
    寻找要么全州名称,或州两个字母,和/或ZIP code(5或9位数字)

  7. 现在,找街道后缀,全额或缩写形式,可选的如果有一个星号

  1. look for a 1 - 5 digit number for a street number (no support for 'One Microsoft Way')
  2. ignore if preceded by '#', Suite, Ste, Rm
  3. look for two or more words (up to 5? North Frank Lloyd Wright Blvd)
    note: "The Circle at North Hills St." has six words, and a lower 'at' -- allow at, by, of, in, the, and, ... ?
  4. if a word starts with a lowercase letter, no match
    allow: , . - # / (for 1/2) ' "
  5. look for one or two delimiters to represent possible 2nd addr line and city name
    look for either full state name, or state two letters, and/or zip code (5 or 9 digits)
  6. now look for street suffix, either in full or abbreviated form, with optional 's' if there's an asterisk

来源:CacheBuilder.cpp。欲了解更多信息,你可以检查精确算法在CacheBuilder :: webviewcore的FindPartialAddress

Source : CacheBuilder.cpp. For further info you could check the exact algorithm in CacheBuilder::FindPartialAddress of webviewcore


在LleY,NneX,RCade,地点,LAMEDA,a您等结尾的街道名称...匹配。
在你的情况的站在乐队不匹配的街道名称结束了在美国的共同

As far as i see from code only street names ending in LleY , NneX, RCade, VEnue, LAMEDA, aYoU and so on ... are matched. In your case Band stand does not match the street name ending that is common in US

这篇关于如何自动链接:地图工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆