点击我的自定义信息窗口中的数字时,启动电话拨号器时遇到问题。每次我点击地图api v2上的标记时,都会出现此信息。这个自定义信息包含一个数字" 567891234"突出显示。
XML布局包含:
<TextView
android:id="@+id/dialer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="phone"
android:background="#ADD8E6"
android:text="567891234" />
我的活动java文件:
private void setUpMap() {
// set position, title and icon for each marker
mMap.addMarker(new MarkerOptions().position(new LatLng(38.66, 19.789)).title("hello").snippet("test \n website: http://www.test.gr \n this is a test message for testing purposes \n to see how big is the custom info window \n for all markers on the map").icon(BitmapDescriptorFactory.fromResource(R.drawable.location_icon)));
// Setting a custom info window adapter for the google map
// when a infoWindow is tapped (infoWindow open request)
mMap.setInfoWindowAdapter(new InfoWindowAdapter() {
// Use default InfoWindow frame
@Override
public View getInfoWindow(Marker marker) {
return null;
}
// Defines the contents of the InfoWindow
@Override
public View getInfoContents(Marker marker) {
// Getting view from the layout file info_window_layout
View v = getLayoutInflater().inflate(R.layout.infowindow_layout, null);
//start phone call
final TextView tvDialer =(TextView) v.findViewById(R.id.dialer);
tvDialer.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:"
+ tvDialer.getText().toString()));
startActivity(callIntent);
}
});
//end phone call
// Returning the view containing InfoWindow contents
return v;
}
}); //Setting a custom info window adapter for the google map */
添加到androidmanifest xml文件的权限:
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
你能告诉我如何解决这个问题,并插入我的数字启动拨号器吗?此外,我需要有不同的&#34;数字&#34;对于每个标记而不是xml布局文件中的静态文本。我怎么能这样做,因为除了.tittle和.snippet?
之外没有标记的相关属性