我在用TextView 的 android:autoLink="map" 属性转到地图并查找与该文本视图关联的地址。
但它的行为很奇怪只找到一些地址。这是我正在尝试的代码:
<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>
这是我的字符串.xml
strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="autolinktext">1600 Amphitheatre Parkway, Mountain View, CA 94043 </string>
</resources>
问题是:
假设我正在写上面的字符串,即1600 Amphitheatre Parkway, 山景城, CA 94043然后它工作正常,textView 颜色变为蓝色,当我单击它时,它会搜索地图上的地址。
当我将此地址更改为:1600 Amphitheatre Parkway, 孟买, IN然后它也显示相同的内容并尝试搜索地址,但由于地址错误,因此无法找到它。没关系。
但是当我写其他地址时,例如:600 Band Stand,孟买,印第安纳州
Then
1)textview不是蓝色的
2)它似乎不可点击
3)由于它不可点击,因此找不到地址。
我正在搜索谷歌,但没有得到这种行为的任何原因。
我也想知道
这个地图地址有什么格式可以写吗?
Android 如何知道地址是否有效
在字符串中写入地址,就像我在其中写入相同的地址一样
相同的格式只是改变了字符串,结果是
地址是可点击的,其他则不可点击。
请帮忙。