当前位置: 首页>>代码示例>>Java>>正文


Java MapView.LayoutParams方法代码示例

本文整理汇总了Java中com.google.android.maps.MapView.LayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java MapView.LayoutParams方法的具体用法?Java MapView.LayoutParams怎么用?Java MapView.LayoutParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.maps.MapView的用法示例。


在下文中一共展示了MapView.LayoutParams方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLocationChanged

import com.google.android.maps.MapView; //导入方法依赖的package包/类
public void onLocationChanged(Location loc) {
    if (loc == null) {
        this.location = null;
        this.pointViewImg.stop();
        this.mapView.removeView(this.pointView);
    } else {
        this.location = new GeoPoint((int)(loc.getLatitude()*1e6), (int)(loc.getLongitude()*1e6));

        // need to move the map in case the location was on the visible map and isn't now (record in draw() using getLatitudeSpan etc.)
        if (this.currentLocationOnScreen && !checkCurrentLocationOnScreen(this.mapView, this.mapView.getProjection())) {
            this.currentLocationOnScreen = true;
            this.mapView.getController().animateTo(this.location);
        }

        this.accuracyAdjusted = loc.getAccuracy();
        // this.accuracyAdjusted = (float)(loc.getAccuracy()/Math.cos(loc.getLatitude()/180.*Math.PI)); // todo would the adjustment be wrong? google doesn't do it...

        this.mapView.removeView(this.pointView);
        MapView.LayoutParams layoutParams = new MapView.LayoutParams(
                this.pointViewImg.getIntrinsicWidth(),
                this.pointViewImg.getIntrinsicHeight(),
                this.location,
                MapView.LayoutParams.CENTER);
        this.pointView.setLayoutParams(layoutParams);
        this.mapView.addView(this.pointView);
        this.pointViewImg.start();

    }
}
 
开发者ID:jacekkopecky,项目名称:parkjam,代码行数:30,代码来源:MyLocationOverlay.java

示例2: setSelected

import com.google.android.maps.MapView; //导入方法依赖的package包/类
private void setSelected(BuildingOverlay overlay) {
	selected = overlay;
	
	if (overlay == null) {
		if (balloon != null) {
			balloon.setVisibility(View.GONE);
		}
	} else {
		Location location = overlay.getLocation();
		boolean recycle = (balloon != null);
		if (!recycle) {
			balloon = new BalloonOverlayView<OverlayItem>(mapView.getContext(), 0);	
			balloon.findViewById(R.id.balloon_close).setVisibility(View.GONE);
			balloon.findViewById(R.id.balloon_disclosure).setVisibility(View.VISIBLE);
			balloon.findViewById(R.id.balloon_inner_layout).setOnTouchListener(balloonTapListener);
		}
		
		balloon.setVisibility(View.GONE);
		
		GeoPoint point = location.center.asGeoPoint();
		MapView.LayoutParams params = new MapView.LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, point,
				MapView.LayoutParams.BOTTOM_CENTER);
		params.mode = MapView.LayoutParams.MODE_MAP;
		balloon.setData(new OverlayItem(null, location.name, location.description));
		balloon.setVisibility(View.VISIBLE);
		
		if (recycle) {
			balloon.setLayoutParams(params);
		} else {
			mapView.addView(balloon, params);
		}
		
		if (manager != null) {
			manager.markSelected();
		}
	}
	
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:40,代码来源:BuildingOverlayLayer.java

示例3: addView

import com.google.android.maps.MapView; //导入方法依赖的package包/类
public void addView(final View view, GeoPoint point, int gravity) {
	final MapView.LayoutParams params = new MapView.LayoutParams(
			MapView.LayoutParams.WRAP_CONTENT, MapView.LayoutParams.WRAP_CONTENT, point, gravity);
	viewItems.add(view);
	handler.post(new Runnable() {
		public void run() {
			map.addView(view, params);
		}
	});
	map.postInvalidate();
}
 
开发者ID:Mapyst,项目名称:Mapyst,代码行数:12,代码来源:ViewItemOverlay.java

示例4: onTap

import com.google.android.maps.MapView; //导入方法依赖的package包/类
@Override
public boolean onTap(int index) {
    OverlayItem item = mOverlays.get(index);
    position = Integer.parseInt(item.getSnippet());
    Atm atm = atms.get(position);

    // If a bubble is currently displayed then clear it.
    if (_bubbleLayout != null) {
        mapView.removeView(_bubbleLayout);
    }

    // Get instance of the Bubble Layout.
    LayoutInflater inflater = (LayoutInflater) mapView.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    _bubbleLayout = (LinearLayout) inflater.inflate(R.layout.bubble, mapView, false);

    // Configure its layout parameters
    double latD = atm.getLatitude();
    double lngD = atm.getLongitude();
    int lat = (int) (latD * 1E6);
    int lng = (int) (lngD * 1E6);
    GeoPoint p = new GeoPoint(lat, lng);
    MapView.LayoutParams params = new MapView.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, p, MapView.LayoutParams.BOTTOM_CENTER);

    _bubbleLayout.setLayoutParams(params);

    // Add title of atm.
    TextView name = (TextView) _bubbleLayout.findViewById(R.id.atm_title);
    name.setText(atm.getName());

    // Add title of atm.
    TextView address = (TextView) _bubbleLayout.findViewById(R.id.atm_address);
    address.setText(atm.getAddress());

    // Link.
    TextView directions = (TextView) _bubbleLayout.findViewById(R.id.directions);
    directions.setText(R.string.info_directions);
    directions.setOnClickListener(detailOnclick);

    // Close button.
    TextView closeButton = (TextView) _bubbleLayout.findViewById(R.id.close_bubble);
    closeButton.setOnClickListener(closeBubble);

    // Add the view to the Map.
    mapView.addView(_bubbleLayout);

    // Animate the map to center on the location.
    mapView.getController().animateTo(p);
    return true;
}
 
开发者ID:swentel,项目名称:gentsefeesten,代码行数:50,代码来源:AtmMap.java

示例5: createAndDisplayBalloonOverlay

import com.google.android.maps.MapView; //导入方法依赖的package包/类
/**
 * Creates and displays the balloon overlay by recycling the current balloon
 * or by inflating it from xml.
 * 
 * @return true if the balloon was recycled false otherwise
 */
private boolean createAndDisplayBalloonOverlay() {
    boolean isRecycled;
    if (balloonView == null) {
        balloonView = createBalloonOverlayView();
        clickRegion = (View)balloonView.findViewById(R.id.balloon_inner_layout);
        clickRegion.setOnTouchListener(createBalloonTouchListener());
        closeRegion = (View)balloonView.findViewById(R.id.balloon_close);
        if (closeRegion != null) {
            closeRegion.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    hideBalloon();
                }
            });
        }
        isRecycled = false;
    } else {
        isRecycled = true;
    }

    balloonView.setVisibility(View.GONE);

    List<Overlay> mapOverlays = mapView.getOverlays();
    if (mapOverlays.size() > 1) {
        hideOtherBalloons(mapOverlays);
    }

    if (currentFocusedItem != null)
        balloonView.setData(currentFocusedItem);

    GeoPoint point = currentFocusedItem.getPoint();
    MapView.LayoutParams params = new MapView.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT, point, MapView.LayoutParams.BOTTOM_CENTER);
    params.mode = MapView.LayoutParams.MODE_MAP;

    balloonView.setVisibility(View.VISIBLE);

    if (isRecycled) {
        balloonView.setLayoutParams(params);
    } else {
        mapView.addView(balloonView, params);
    }

    return isRecycled;
}
 
开发者ID:bartfaizoltan,项目名称:Joszolgalat_Android_App,代码行数:52,代码来源:MapItemizedOverlay.java


注:本文中的com.google.android.maps.MapView.LayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。