久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='cZAYw'></small><noframes id='cZAYw'>

      <bdo id='cZAYw'></bdo><ul id='cZAYw'></ul>
  1. <i id='cZAYw'><tr id='cZAYw'><dt id='cZAYw'><q id='cZAYw'><span id='cZAYw'><b id='cZAYw'><form id='cZAYw'><ins id='cZAYw'></ins><ul id='cZAYw'></ul><sub id='cZAYw'></sub></form><legend id='cZAYw'></legend><bdo id='cZAYw'><pre id='cZAYw'><center id='cZAYw'></center></pre></bdo></b><th id='cZAYw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cZAYw'><tfoot id='cZAYw'></tfoot><dl id='cZAYw'><fieldset id='cZAYw'></fieldset></dl></div>
    <legend id='cZAYw'><style id='cZAYw'><dir id='cZAYw'><q id='cZAYw'></q></dir></style></legend>
  2. <tfoot id='cZAYw'></tfoot>

      MapView 中的 OnTouch 僅在第一次觸發

      OnTouch in MapView only fires the first time(MapView 中的 OnTouch 僅在第一次觸發)
      <i id='SNzNW'><tr id='SNzNW'><dt id='SNzNW'><q id='SNzNW'><span id='SNzNW'><b id='SNzNW'><form id='SNzNW'><ins id='SNzNW'></ins><ul id='SNzNW'></ul><sub id='SNzNW'></sub></form><legend id='SNzNW'></legend><bdo id='SNzNW'><pre id='SNzNW'><center id='SNzNW'></center></pre></bdo></b><th id='SNzNW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SNzNW'><tfoot id='SNzNW'></tfoot><dl id='SNzNW'><fieldset id='SNzNW'></fieldset></dl></div>
          <bdo id='SNzNW'></bdo><ul id='SNzNW'></ul>
            <legend id='SNzNW'><style id='SNzNW'><dir id='SNzNW'><q id='SNzNW'></q></dir></style></legend>
              <tbody id='SNzNW'></tbody>

            <tfoot id='SNzNW'></tfoot>

            • <small id='SNzNW'></small><noframes id='SNzNW'>

              1. 本文介紹了MapView 中的 OnTouch 僅在第一次觸發的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在嘗試在我的 MapView 中實現雙擊縮放功能.該事件總是第一次觸發,但以后不會觸發.下面是我的代碼.我感覺這與第一次觸發事件后地圖控制器丟失有關.

                I'm trying to implement a double-tap zoom like function in my MapView. The event always fires the first time, but never subsequent times. Below is my code. I have a feeling it has something to do with the map controller getting lost after the first time the event is fired.

                import android.os.Bundle;
                import android.view.MotionEvent;
                import android.view.View;
                import android.view.View.OnTouchListener;
                import com.google.android.maps.MapActivity;
                import com.google.android.maps.MapController;
                import com.google.android.maps.MapView;
                
                public class mainmap extends MapActivity implements OnTouchListener{
                
                    long lasttime = -1;
                    MapController mapc;
                
                    @Override
                    public void onCreate(Bundle savedInstanceState) {
                        super.onCreate(savedInstanceState);
                        setContentView(R.layout.main);
                        MapView mapView = (MapView) findViewById(R.id.mapview);
                        mapView.setBuiltInZoomControls(true);
                        mapc = mapView.getController();
                        mapView.setOnTouchListener(this);       
                    }
                
                    @Override
                    protected boolean isRouteDisplayed() {
                        // TODO Auto-generated method stub
                        return false;
                    }
                
                    @Override
                    public boolean onTouch(View v, MotionEvent event) {
                        if (event.getAction() == MotionEvent.ACTION_DOWN){
                
                            if(event.getEventTime()-lasttime<2000){
                                mapc.zoomInFixing((int)event.getX(),(int)event.getY());             
                            }
                        }       
                        lasttime=event.getEventTime();
                        return true;
                    }
                
                  }
                

                我還嘗試編輯 OnTouch 方法以將傳入的 View 轉換為 MapView,在觸發事件時獲取控制器.但是,在觸發第一個事件而不是后續事件的情況下,我得到了相同的結果.

                I have also tried editing the OnTouch method to cast the incoming View to a MapView, getting the controller while the event is fired. However, I get the same results where the first event is fired but not subsequent ones.

                public boolean onTouch(View v, MotionEvent event) {
                        if (event.getAction() == MotionEvent.ACTION_DOWN){
                
                            if(event.getEventTime()-lasttime<2000){
                                ((MapView)v).getController().zoomInFixing((int)event.getX(), (int)event.getY());                
                            }
                        }       
                        lasttime=event.getEventTime();
                        return true;
                    }
                

                為了盡可能簡單,我刪除了 OnTouch 方法中的所有代碼,并將其編程為簡單地顯示一條小的 toast 消息.

                Being as basic as possible, I cut out all of the code in the OnTouch method and programmed it to simply display a small toast message.

                public boolean onTouch(View v, MotionEvent event) {
                        if (event.getAction() == MotionEvent.ACTION_DOWN){
                
                               Toast.makeText(this,"Down!",Toast.LENGTH_SHORT).show();
                
                        }       
                
                        return true;
                }
                

                這按預期工作,每次觸摸 MapView 時都會顯示 Toast.

                This works as expected, displaying the Toast each time the MapView is touched.

                我不明白為什么在這種情況下事件會正確觸發,但在我之前的實現中卻不會.

                I don't understand why the event will fire properly in this case but not in my previous implementation.

                推薦答案

                如果你使用這個方法 "mapView.setBuiltInZoomControls(true);" 那么你的 touch 是立即工作.

                If you are using this method "mapView.setBuiltInZoomControls(true);" then your touch is working at once .

                請刪除該行并檢查我確定它會起作用..

                Please remove that that line and check I am sure it will work..

                在某些情況下,如果您想要 BuiltInZoomControls,那么您可以使用 OnTouch 的 Overlay 方法,如下所示..

                In some case if you want BuiltInZoomControls then you can you OnTouch method of Overlay like as below..

                public class MapOverlay extends Overlay {
                
                    public MapOverlay(Context ctx) {super(ctx);}
                
                    @Override
                    protected void draw(Canvas c, MapView osmv, boolean shadow) { }
                
                    @Override
                    public boolean onTouchEvent(MotionEvent e, MapView mapView) {
                        //Write yout touch code here..
                        return false;
                    }
                }
                

                這篇關于MapView 中的 OnTouch 僅在第一次觸發的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)
                Get current location during app launch(在應用啟動期間獲取當前位置)
                locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)

                  <small id='gjcOf'></small><noframes id='gjcOf'>

                  • <i id='gjcOf'><tr id='gjcOf'><dt id='gjcOf'><q id='gjcOf'><span id='gjcOf'><b id='gjcOf'><form id='gjcOf'><ins id='gjcOf'></ins><ul id='gjcOf'></ul><sub id='gjcOf'></sub></form><legend id='gjcOf'></legend><bdo id='gjcOf'><pre id='gjcOf'><center id='gjcOf'></center></pre></bdo></b><th id='gjcOf'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gjcOf'><tfoot id='gjcOf'></tfoot><dl id='gjcOf'><fieldset id='gjcOf'></fieldset></dl></div>
                      <bdo id='gjcOf'></bdo><ul id='gjcOf'></ul>

                          <tbody id='gjcOf'></tbody>
                      1. <legend id='gjcOf'><style id='gjcOf'><dir id='gjcOf'><q id='gjcOf'></q></dir></style></legend>
                          <tfoot id='gjcOf'></tfoot>

                        • 主站蜘蛛池模板: 欧美精品一区二区在线观看 | 在线播放一区 | a级在线免费观看 | 日韩精品一区二区三区四区视频 | av在线视| 一区不卡在线观看 | 精品欧美激情在线观看 | 欧美一级二级三级视频 | 国产一在线观看 | 国产 日韩 欧美 中文 在线播放 | 色综合区| 欧美 日韩 中文 | 国产精品国产三级国产aⅴ中文 | 天天躁天天操 | 免费看欧美一级片 | 日韩激情免费 | 一区二区高清不卡 | 一级毛片在线看 | 日本精品一区二区三区视频 | 亚洲国产欧美一区 | 久久久久久久网 | 在线观看你懂的网站 | 91久久久久久久久久久 | 久久精品毛片 | av中文字幕在线播放 | 日韩精品视频中文字幕 | 欧美天堂 | 色999视频| www一级片 | 亚洲一区二区在线播放 | 久久精品一级 | 一区二区三区免费观看 | 毛片一级片| 日本超碰 | 精品国产欧美 | 国产精品18hdxxxⅹ在线 | 国产欧美精品区一区二区三区 | 91精品国产91久久久久久吃药 | 国产免费一区二区 | 日韩成人国产 | 在线视频中文字幕 |