在 Xamarin 中,如何让自动链接与 Google Map InfoWindow 中显示的一些 TextView 一起使用。
这是我的 custom_info_window XML 代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical" >
<TextView
android:id="@+id/Phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:autoLink="phone"/>
<TextView
android:id="@+id/Web"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:autoLink="web"/>
</LinearLayout>
这是我的 InfoWindow 类:
public class InfoWindow : Java.Lang.Object, GoogleMap.IInfoWindowAdapter
{
public View GetInfoContents(Marker p0)
{
var inflater = Application.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater;
View v = inflater.Inflate(Resource.Layout.custom_info_window, null);
TextView title = (TextView) v.FindViewById(Resource.Id.Phone);
title.Text = "Phone number: 0800 32 32 32";
TextView description = (TextView) v.FindViewById(Resource.Id.Web);
description.Text = "Email address: me@me.com";
return v;
}
public View GetInfoWindow(Marker p0)
{
return null;
}
}
当我单击标记时,我会显示 InfoWindow,并且它的格式正确,如 InfoWindow 类中的编码。
但是,当我单击任一自动链接项目时,自动链接不起作用。InfoWindow 上的单击仅注册为整个 InfoWindow 单击,并且不会分成两个不同的 TextView。
我可以帮忙吗?
提前致谢