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


Java MapView.setOnTouchListener方法代码示例

本文整理汇总了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);
    }
 
开发者ID:joy-inc,项目名称:joy-app,代码行数:37,代码来源:MapActivity.java

示例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();
}
 
开发者ID:InspectorIncognito,项目名称:androidApp,代码行数:64,代码来源:AccountBusPickerActivity.java


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