本文整理匯總了Java中com.google.android.maps.MapView.getWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java MapView.getWidth方法的具體用法?Java MapView.getWidth怎麽用?Java MapView.getWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.android.maps.MapView
的用法示例。
在下文中一共展示了MapView.getWidth方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: draw
import com.google.android.maps.MapView; //導入方法依賴的package包/類
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
if (overlayImage == null || overlayImage.isRecycled()) {
return false;
}
float x = mapView.getWidth() / 2f;
float y = mapView.getHeight() / 2f;
imageMatrix.reset();
imageMatrix.postTranslate(-centerX + x, -centerY + y);
imageMatrix.postRotate(rotation, x, y);
imageMatrix.postScale(scale, scale, x, y);
canvas.drawBitmap(overlayImage, imageMatrix, transparency);
// Draw small black ring with white edge to indicate center point
centerPaint.setColor(0xffffffff);
centerPaint.setStrokeWidth(4f);
canvas.drawCircle(x, y, 5, centerPaint);
centerPaint.setColor(0xff000000);
centerPaint.setStrokeWidth(2f);
canvas.drawCircle(x, y, 5, centerPaint);
return false;
}
示例2: animateTo
import com.google.android.maps.MapView; //導入方法依賴的package包/類
@Override
protected void animateTo(int index, GeoPoint center) {
if (manager != null) {
manager.markSelected();
}
MapView mapView = getMapView();
ViewController controller = new ViewController(mapView);
Point pt = new Point(mapView.getWidth() / 2, mapView.getHeight() / 2);
int spanLat = bounds.top - bounds.bottom;
int spanLon = bounds.left - bounds.right;
controller.animateTo(center, pt, spanLat, spanLon, animate);
}
示例3: animateTo
import com.google.android.maps.MapView; //導入方法依賴的package包/類
@Override
protected void animateTo(int index, GeoPoint center) {
if (manager != null) {
manager.markSelected();
}
MapView mapView = getMapView();
ViewController controller = new ViewController(mapView);
Point pt = new Point(mapView.getWidth() / 2, mapView.getHeight() / 4 * 3);
controller.animateTo(center, pt, MIN_ZOOM_LEVEL + 1, true);
}
示例4: animateTo
import com.google.android.maps.MapView; //導入方法依賴的package包/類
@Override
protected void animateTo(int index, GeoPoint center) {
if (manager != null) {
manager.markSelected();
}
MapView mapView = getMapView();
ViewController controller = new ViewController(mapView);
Point pt = new Point(mapView.getWidth() / 2, mapView.getHeight() / 4 * 3);
controller.animateTo(center, pt, MIN_ZOOM_LEVEL + 1, animate);
}
示例5: onTouchEvent
import com.google.android.maps.MapView; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(MotionEvent event, MapView mapView) {
if (directions == null)
return super.onTouchEvent(event, mapView);
Point center = new Point(mapView.getWidth() / 2, mapView.getHeight() / 2); // simple calc of center pixel
int closestDir = curDir; // assume its the same
double bestMin = Double.MAX_VALUE; // closest direction so far
// the algorithm is as follows: find the shortest distance from the
// center
// of the screen to each direction. Then, change to the direction that
// is
// closest to the center
for (int i = 0; i < directions.length; i++) {
Point[] dirPixelPoints = pixelPoints[i];
if (directions[i].getType() == Direction.SAME_FLOOR) {
double avgDist = (DrawingHelpers.distance(dirPixelPoints[0],center)
+ DrawingHelpers.distance(dirPixelPoints[dirPixelPoints.length / 2],center) + DrawingHelpers.distance(
dirPixelPoints[dirPixelPoints.length - 1], center)) / 2.0;
if (avgDist < bestMin) {
bestMin = avgDist;
closestDir = i;
}
}
}
// only changes the direction if the direction being automatically
// switched to is and outside direction
if (curDir != closestDir && // inefficient to setui if we don't need to
app.campus.buildingIsOutside(directions[closestDir].getBuilding()) && // only change if moving between outside points
app.campus.buildingIsOutside(directions[curDir].getBuilding())) {
if (main != null) {
main.setUI(closestDir, false); // calling this, we set the bitmaps + the icons
} else {
main.setUI(closestDir, false);
}
}
return super.onTouchEvent(event, mapView); // not stealing the event
}