本文整理匯總了Java中org.osmdroid.views.MapView.setOnTouchListener方法的典型用法代碼示例。如果您正苦於以下問題:Java MapView.setOnTouchListener方法的具體用法?Java MapView.setOnTouchListener怎麽用?Java MapView.setOnTouchListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.osmdroid.views.MapView
的用法示例。
在下文中一共展示了MapView.setOnTouchListener方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initContentView
import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
protected void initContentView() {
mResourceProxy = new OsmResourceImpl(this);
mapview = new MapView(this,mResourceProxy);
OnlineTileSourceBase GoogleMap = GoogleTileSource.getDefultGoogleTileSource();
mapview.setTileSource(GoogleMap);
FrameLayout.LayoutParams mapParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
maplayout.addView(mapview, mapParams);
mapview.setTilesScaledToDpi(true);
mapview.setMinZoomLevel(3);
mapview.setMultiTouchControls(true);
mapview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (!isTouchable){
return false;
}
if (ontouch(event)){
isClick = false;
v.postDelayed(cleanMarker,500);
}
return false;
}
});
ivPath.setOnClickListener(this);
poiMapPathBtn.setOnClickListener(this);
poiMapLocationBar.setOnClickListener(this);
llContent.setOnClickListener(this);
// locationClient = new AMapLocationClient(getApplicationContext());
locationUtil = JoyApplication.getLocationUtil();
locationUtil.gettAccuracyLocation(this,2000);
// MapUtil.initAccuracyLocation(locationClient, this);
}
示例2: onCreate
import org.osmdroid.views.MapView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_account_user_bus_picker);
final MapView mapView = (MapView) findViewById(R.id.map);
final MapBoxTileSource tileSource = new MapBoxTileSource("mapbox", 1, 20, 256, ".png");
tileSource.retrieveAccessToken(this);
tileSource.retrieveMapBoxMapId(this);
mapView.setTileSource(tileSource);
/* Set map controls */
mapView.setMultiTouchControls(true);
mapView.getController().setCenter(new GeoPoint(pMapInitLat, pMapInitLon));
mapView.getController().setZoom(18);
mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
mapView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
currentAccount = TranSappAccountManager.getCurrentAccount();
if (currentAccount == null) {
this.finish();
return;
}
serverBusAvatarId = currentAccount.getBusAvatarId();
busAvatarId = serverBusAvatarId;
final ActiveBusView activeBusView = new ActiveBusView(this, "506v", serverBusAvatarId, false);
final Marker startMarker = new Marker(mapView);
startMarker.setPosition(new GeoPoint(pInitLat, pInitLon));
startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
startMarker.setIcon(activeBusView.getBitmapDrawable());
mapView.getOverlays().add(startMarker);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.bus_picker_recycler_view);
BusAvatarRowAdapter adapter = new BusAvatarRowAdapter(this, AvatarLists.BUS_AVATARS, new BusAvatarRowAdapter.AvatarClickListener() {
@Override
public void onNewAvatarSelected(int serverId) {
busAvatarId = serverId;
activeBusView.setAvatarId(serverId);
startMarker.setIcon(activeBusView.getBitmapDrawable());
mapView.invalidate();
}
}, currentAccount.getLevelPosition(), currentAccount.getBusAvatarId());
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
recyclerView.invalidate();
}