本文整理汇总了Java中com.baidu.mapapi.map.InfoWindow类的典型用法代码示例。如果您正苦于以下问题:Java InfoWindow类的具体用法?Java InfoWindow怎么用?Java InfoWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InfoWindow类属于com.baidu.mapapi.map包,在下文中一共展示了InfoWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toggleInfoWindow
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
private void toggleInfoWindow(Marker marker) {
if (marker == null || mapView == null || mapView.getMap() == null) return;
if (isInfoWindowShown) {
mapView.getMap().hideInfoWindow();
isInfoWindowShown = false;
} else {
// sdk示例代码是用application context来创建infoWindow上的View的
// 如果该view直接放在activity上,重复执行show/hide/show会出错
View view = LayoutInflater.from(getApplicationContext())
.inflate(R.layout.locatino_map_point, null);
TextView textView = (TextView) view.findViewById(R.id.textView);
textView.setText(marker.getTitle());
int yOffset = (int) (0.5f + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40, getResources().getDisplayMetrics()));
mapView.getMap().showInfoWindow(new InfoWindow(
BitmapDescriptorFactory.fromView(textView),
new LatLng(latitude, longitude), -yOffset, null));
isInfoWindowShown = true;
}
}
示例2: initMarkerClickEvent
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
private void initMarkerClickEvent() {
mBaiduMap.setOnMarkerClickListener(new OnMarkerClickListener()
{
@Override
public boolean onMarkerClick(final Marker marker)
{
LatLng markerLat = marker.getPosition();
Point p = mBaiduMap.getProjection().toScreenLocation(markerLat);
//mMarkerInfoLy.setVisibility(View.VISIBLE);
View location = getPopCameraView();
p.y = -83;
mInfoWindow = new InfoWindow(location, markerLat,p.y);
mBaiduMap.showInfoWindow(mInfoWindow);
// Log.d("wang","setOnMarkerClickListener location.latitude is " + markerLat.latitude + " location.longitude is " + markerLat.longitude);
judgeClickCamera(markerLat);
flag = true;
return true;
}
});
}
示例3: onMarkerClick
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
Log.d("lml", "MapFragment:覆盖物被点击");
baiduMap.hideInfoWindow();
if (marker != null) {
latLngshow = marker.getPosition();
reverseGeoCodeOption.location(latLngshow);
geoCoder.reverseGeoCode(reverseGeoCodeOption);
tvAddOverlayGeoCoder.setText("正在获取详细位置");
bundle = marker.getExtraInfo();
generalIsMale = bundle.getString("general").equals("m");
layoutAddOverlayRadarNearbyItem.setBackgroundColor(getResources().getColor(generalIsMale ? R.color.blue : R.color.pink));
imageViewAddOverlayItem.setImageResource(generalIsMale ? R.mipmap.map_portrait_man : R.mipmap.map_portrait_woman);
tvAddOverlayItemUserID.setText(bundle.getString("userID"));
tvAddOverlayItemDistance.setText("距离" + bundle.getInt("distance") + "米 ");
tvAddOverlayItemLatlng.setText("坐标: " + latLngshow.latitude + " , " + latLngshow.longitude + " ");
Log.d("lml", "MapFragment显示的信息:" + bundle.getString("userID"));
Log.d("lml", bundle.getString("general") + ";" + generalIsMale);
baiduMap.showInfoWindow(new InfoWindow(viewOverlayItem, marker.getPosition(), -70));
MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(marker.getPosition());
baiduMap.animateMapStatus(update);
return true;
} else
return false;
}
示例4: onMarkerClick
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
@Override
public boolean onMarkerClick(final Marker marker) {
final LatLng ll = marker.getPosition();
Point p = mBaiduMap.getProjection().toScreenLocation(ll);
p.y -= 47;
LatLng llInfo = mBaiduMap.getProjection().fromScreenLocation(p);
Button button = new Button(getApplicationContext());
if (marker == mMarker) {
button.setText(marker.getPosition().latitude + " // "
+ marker.getPosition().longitude);
}
InfoWindow mInfoWindow = new InfoWindow(button, llInfo,
mOnInfoWindowClickListener);
mBaiduMap.showInfoWindow(mInfoWindow);
return true;
}
示例5: onMarkerClick
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
@Override
public boolean onMarkerClick(final Marker marker) {
final LatLng ll = marker.getPosition();
Point p = mBaiduMap.getProjection().toScreenLocation(ll);
p.y -= 47;
LatLng llInfo = mBaiduMap.getProjection().fromScreenLocation(p);
Button button = new Button(getApplicationContext());
if (marker == mMarkerA) {
button.setText(marker.getPosition().latitude + " // "
+ marker.getPosition().longitude);
} else if (marker == mMarkerB) {
button.setText(getDistanceMsg(mCenterLatLng, ll));
} else if (marker == mMarkerC) {
button.setText(getDistanceMsg(mCenterLatLng, ll));
}
InfoWindow mInfoWindow = new InfoWindow(button, llInfo,
mOnInfoWindowClickListener);
mBaiduMap.showInfoWindow(mInfoWindow);
return true;
}
示例6: initNearestBike
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
private void initNearestBike(final BikeInfo bikeInfo, LatLng ll) {
ImageView nearestIcon = new ImageView(getApplicationContext());
nearestIcon.setImageResource(R.mipmap.nearest_icon);
InfoWindow.OnInfoWindowClickListener listener = null;
listener = new InfoWindow.OnInfoWindowClickListener() {
public void onInfoWindowClick() {
updateBikeInfo(bikeInfo);
mBaiduMap.hideInfoWindow();
}
};
InfoWindow mInfoWindow = new InfoWindow(BitmapDescriptorFactory.fromView(nearestIcon), ll, -108, listener);
mBaiduMap.showInfoWindow(mInfoWindow);
}
示例7: initNearestBike
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
private void initNearestBike(final BikeInfo bikeInfo, LatLng latLng) {
ImageView nearestIcon = new ImageView(getApplicationContext());
nearestIcon.setImageResource(R.mipmap.nearest_icon);
InfoWindow.OnInfoWindowClickListener listener = null;
listener = new InfoWindow.OnInfoWindowClickListener() {
public void onInfoWindowClick() {
updateBikeInfo(bikeInfo);
baiduMap.hideInfoWindow();
}
};
InfoWindow mInfoWindow = new InfoWindow(BitmapDescriptorFactory.fromView(nearestIcon), latLng, -108, listener);
baiduMap.showInfoWindow(mInfoWindow);
}
示例8: doGetMode
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
/**
* 获取节结果信息
*/
private void doGetMode() {
LatLng nodeLocation = null;
String nodeTitle = null;
Object step = route.getAllStep().get(nodeIndex);
if (step instanceof DrivingRouteLine.DrivingStep) {
nodeLocation = ((DrivingRouteLine.DrivingStep) step).getEntrance().getLocation();
nodeTitle = ((DrivingRouteLine.DrivingStep) step).getInstructions();
} else if (step instanceof WalkingRouteLine.WalkingStep) {
nodeLocation = ((WalkingRouteLine.WalkingStep) step).getEntrance().getLocation();
nodeTitle = ((WalkingRouteLine.WalkingStep) step).getInstructions();
} else if (step instanceof TransitRouteLine.TransitStep) {
nodeLocation = ((TransitRouteLine.TransitStep) step).getEntrance().getLocation();
nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
} else if (step instanceof BikingRouteLine.BikingStep) {
nodeLocation = ((BikingRouteLine.BikingStep) step).getEntrance().getLocation();
nodeTitle = ((BikingRouteLine.BikingStep) step).getInstructions();
}
if (nodeLocation == null || nodeTitle == null) {
return;
}
// 移动节点至中心
mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(nodeLocation));
// show popup
TextView popupText = new TextView(this);
popupText.setBackgroundResource(R.drawable.popup);
popupText.setTextColor(0xFF000000);
popupText.setText(nodeTitle);
mBaiduMap.showInfoWindow(new InfoWindow(popupText, nodeLocation, 0));
}
示例9: nodeClick
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
/**
* �ڵ����ʾ��
*
* @param v
*/
public void nodeClick(View v) {
if (nodeIndex < -1 || route == null
|| nodeIndex >= route.getStations().size())
return;
TextView popupText = new TextView(this);
popupText.setBackgroundResource(R.drawable.popup);
popupText.setTextColor(0xff000000);
// ��һ���ڵ�
if (mBtnPre.equals(v) && nodeIndex > 0) {
// ������
nodeIndex--;
}
// ��һ���ڵ�
if (mBtnNext.equals(v) && nodeIndex < (route.getStations().size() - 1)) {
// ������
nodeIndex++;
}
if (nodeIndex >= 0) {
// �ƶ���ָ������������
mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(route
.getStations().get(nodeIndex).getLocation()));
// ��������
popupText.setText(route.getStations().get(nodeIndex).getTitle());
mBaiduMap.showInfoWindow(new InfoWindow(popupText, route
.getStations().get(nodeIndex).getLocation(), 0));
}
}
示例10: nodeClick
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
/**
* 节点浏览示例
*
* @param v
*/
public void nodeClick(View v) {
if (nodeIndex < -1 || route == null
|| nodeIndex >= route.getStations().size())
return;
TextView popupText = new TextView(this);
popupText.setBackgroundResource(R.drawable.popup);
popupText.setTextColor(0xff000000);
// 上一个节点
if (mBtnPre.equals(v) && nodeIndex > 0) {
// 索引减
nodeIndex--;
}
// 下一个节点
if (mBtnNext.equals(v) && nodeIndex < (route.getStations().size() - 1)) {
// 索引加
nodeIndex++;
}
if(nodeIndex >= 0){
// 移动到指定索引的坐标
mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(route
.getStations().get(nodeIndex).getLocation()));
// 弹出泡泡
popupText.setText(route.getStations().get(nodeIndex).getTitle());
mBaiduMap.showInfoWindow(new InfoWindow(popupText, route.getStations()
.get(nodeIndex).getLocation(), 0));
}
}
示例11: ShowInfoWindow
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
private void ShowInfoWindow(PoiDetailResult result) {
TextView tv = new TextView(this);
tv.setBackgroundResource(R.drawable.popup);
tv.setPadding(30, 20, 30, 50);
tv.setGravity(Gravity.CENTER);
tv.setText(result.getName());
LatLng ll = new LatLng(result.getLocation().latitude, result.getLocation().longitude);
InfoWindow infoWindow = new InfoWindow(tv, ll, -47);
mBaiduMap.showInfoWindow(infoWindow);
}
示例12: nodeClick
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
public void nodeClick(View v) {
if (nodeIndex < -1 || route == null
|| nodeIndex >= route.getStations().size())
return;
TextView popupText = new TextView(this);
popupText.setBackgroundResource(R.drawable.popup);
popupText.setTextColor(0xff000000);
// 上一个节点
if (mBtnPre.equals(v) && nodeIndex > 0) {
// 索引减
nodeIndex--;
}
// 下一个节点
if (mBtnNext.equals(v) && nodeIndex < (route.getStations().size() - 1)) {
// 索引加
nodeIndex++;
}
if(nodeIndex >= 0){
// 移动到指定索引的坐标
mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(route
.getStations().get(nodeIndex).getLocation()));
// 弹出泡泡
popupText.setText(route.getStations().get(nodeIndex).getTitle());
popupText.setGravity(Gravity.CENTER);
mBaiduMap.showInfoWindow(new InfoWindow(popupText, route.getStations()
.get(nodeIndex).getLocation(), 0));
}
}
示例13: nodeClick
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
/**
* 节点浏览示例
*
* @param v
*/
public void nodeClick(View v) {
if (nodeIndex < -1 || route == null
|| nodeIndex >= route.getStations().size())
return;
TextView popupText = new TextView(this);
popupText.setBackgroundResource(R.drawable.popup);
popupText.setTextColor(0xff000000);
// 上一个节点
if (mBtnPre.equals(v) && nodeIndex > 0) {
// 索引减
nodeIndex--;
}
// 下一个节点
if (mBtnNext.equals(v) && nodeIndex < (route.getStations().size() - 1)) {
// 索引加
nodeIndex++;
}
if(nodeIndex >= 0){
// 移动到指定索引的坐标
mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(route
.getStations().get(nodeIndex).getLocation()));
// 弹出泡泡
popupText.setText(route.getStations().get(nodeIndex).getTitle());
mBaiduMap.showInfoWindow(new InfoWindow(popupText, route.getStations()
.get(nodeIndex).getLocation(), 0));
}
}
示例14: nodeClick
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
/**
* 节点浏览示例
*
* @param v
*/
public void nodeClick(View v) {
if (route == null || route.getAllStep() == null) {
return;
}
if (nodeIndex == -1 && v.getId() == R.id.pre) {
return;
}
// 设置节点索引
if (v.getId() == R.id.next) {
if (nodeIndex < route.getAllStep().size() - 1) {
nodeIndex++;
} else {
return;
}
} else if (v.getId() == R.id.pre) {
if (nodeIndex > 0) {
nodeIndex--;
} else {
return;
}
}
// 获取节结果信息
LatLng nodeLocation = null;
String nodeTitle = null;
Object step = route.getAllStep().get(nodeIndex);
if (step instanceof DrivingRouteLine.DrivingStep) {
nodeLocation = ((DrivingRouteLine.DrivingStep) step).getEntrance().getLocation();
nodeTitle = ((DrivingRouteLine.DrivingStep) step).getInstructions();
} else if (step instanceof WalkingRouteLine.WalkingStep) {
nodeLocation = ((WalkingRouteLine.WalkingStep) step).getEntrance().getLocation();
nodeTitle = ((WalkingRouteLine.WalkingStep) step).getInstructions();
} else if (step instanceof TransitRouteLine.TransitStep) {
nodeLocation = ((TransitRouteLine.TransitStep) step).getEntrance().getLocation();
nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
} else if (step instanceof BikingRouteLine.BikingStep) {
nodeLocation = ((BikingRouteLine.BikingStep) step).getEntrance().getLocation();
nodeTitle = ((BikingRouteLine.BikingStep) step).getInstructions();
}
if (nodeLocation == null || nodeTitle == null) {
return;
}
// 移动节点至中心
mBaidumap.setMapStatus(MapStatusUpdateFactory.newLatLng(nodeLocation));
// show popup
popupText = new TextView(RoutePlanDemo.this);
popupText.setBackgroundResource(R.drawable.popup);
popupText.setTextColor(0xFF000000);
popupText.setText(nodeTitle);
mBaidumap.showInfoWindow(new InfoWindow(popupText, nodeLocation, 0));
}
示例15: nodeClick
import com.baidu.mapapi.map.InfoWindow; //导入依赖的package包/类
/**
* �ڵ����ʾ��
*
* @param v
*/
public void nodeClick(View v) {
if (route == null || route.getAllStep() == null) {
return;
}
if (nodeIndex == -1 && v.getId() == R.id.pre) {
return;
}
// ���ýڵ�����
if (v.getId() == R.id.next) {
if (nodeIndex < route.getAllStep().size() - 1) {
nodeIndex++;
} else {
return;
}
} else if (v.getId() == R.id.pre) {
if (nodeIndex > 0) {
nodeIndex--;
} else {
return;
}
}
// ��ȡ�ڽ����Ϣ
LatLng nodeLocation = null;
String nodeTitle = null;
Object step = route.getAllStep().get(nodeIndex);
nodeLocation = ((TransitRouteLine.TransitStep) step).getEntrance()
.getLocation();
nodeTitle = ((TransitRouteLine.TransitStep) step).getInstructions();
if (nodeLocation == null || nodeTitle == null) {
return;
}
// �ƶ��ڵ�������
mBaidumap.setMapStatus(MapStatusUpdateFactory.newLatLng(nodeLocation));
// show popup
popupText = new TextView(TransferOnlineActivity.this);
popupText.setBackgroundResource(R.drawable.popup);
popupText.setTextColor(0xFF000000);
popupText.setText(nodeTitle);
mBaidumap.showInfoWindow(new InfoWindow(popupText, nodeLocation, 0));
}