<tfoot id='JTkrt'></tfoot>
        <i id='JTkrt'><tr id='JTkrt'><dt id='JTkrt'><q id='JTkrt'><span id='JTkrt'><b id='JTkrt'><form id='JTkrt'><ins id='JTkrt'></ins><ul id='JTkrt'></ul><sub id='JTkrt'></sub></form><legend id='JTkrt'></legend><bdo id='JTkrt'><pre id='JTkrt'><center id='JTkrt'></center></pre></bdo></b><th id='JTkrt'></th></span></q></dt></tr></i><div id='JTkrt'><tfoot id='JTkrt'></tfoot><dl id='JTkrt'><fieldset id='JTkrt'></fieldset></dl></div>
      1. <small id='JTkrt'></small><noframes id='JTkrt'>

          <bdo id='JTkrt'></bdo><ul id='JTkrt'></ul>
        <legend id='JTkrt'><style id='JTkrt'><dir id='JTkrt'><q id='JTkrt'></q></dir></style></legend>

        viewpager 页面中 mapview 的手势问题

        gesture issue with mapview in viewpager page(viewpager 页面中 mapview 的手势问题)
              <tbody id='B6b8K'></tbody>
              <tfoot id='B6b8K'></tfoot>
              • <bdo id='B6b8K'></bdo><ul id='B6b8K'></ul>

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

                • <i id='B6b8K'><tr id='B6b8K'><dt id='B6b8K'><q id='B6b8K'><span id='B6b8K'><b id='B6b8K'><form id='B6b8K'><ins id='B6b8K'></ins><ul id='B6b8K'></ul><sub id='B6b8K'></sub></form><legend id='B6b8K'></legend><bdo id='B6b8K'><pre id='B6b8K'><center id='B6b8K'></center></pre></bdo></b><th id='B6b8K'></th></span></q></dt></tr></i><div id='B6b8K'><tfoot id='B6b8K'></tfoot><dl id='B6b8K'><fieldset id='B6b8K'></fieldset></dl></div>
                  <legend id='B6b8K'><style id='B6b8K'><dir id='B6b8K'><q id='B6b8K'></q></dir></style></legend>
                  本文介绍了viewpager 页面中 mapview 的手势问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的应用程序的主界面是一个viewpager,用户只需水平滑动页面即可到达各个页面.其中一页有一个谷歌地图视图(粘贴在下面).我的问题是,如果用户在地图页面上并使用水平滑动手势,页面会滑动到下一页而不是地图横向移动.就好像 viewpager 在地图之前获取手势一样.

                  My app's main interface is a viewpager where the user just slides the pages horizontally to get to the various pages. One of the pages has a google mapview (pasted below). My problem is that if the user is on the map page and uses a horizontal slide gesture, the page slides to the next page instead of the map moving sideways. It's as if the viewpager is getting the gesture before the map.

                  如果用户很聪明并开始沿对角线或垂直方向滑动地图,则地图开始移动,然后手势可以水平继续.但我更喜欢地图移动而不是简单的水平滑动手势上的页面.页面始终可以使用 textview 滑动.

                  If the user is clever and begins sliding the map in a diagonal or vertical direction the map begins moving and then the gesture can continue horizontally. But I would prefer the map move instead of the page on a simple horizontal slide gesture. The page can always be slid using the textview.

                  有什么办法可以做到这一点?
                  谢谢,加里

                  Is there any way I can make this happen?
                  thanks, Gary

                  <?xml version="1.0" encoding="utf-8"?>
                  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:id="@+id/ContentPanel"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:orientation="vertical" >
                  
                   <TextView
                      android:id="@+id/tvMAP"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="Map"
                      style="@style/bigtype" />
                  
                  
                  <com.google.android.maps.MapView
                      android:id="@+id/mapview"
                      android:layout_width="fill_parent"
                      android:layout_height="fill_parent"
                      android:apiKey="mykeygoeshere"
                      android:clickable="true" />
                  
                  </LinearLayout>
                  

                  推荐答案

                  当然有:

                  public class CustomViewPager extends ViewPager {
                  
                      public CustomViewPager(Context context) {
                          super(context);
                      }
                  
                      public CustomViewPager(Context context, AttributeSet attrs) {
                          super(context, attrs);
                      }
                  
                      @Override
                      protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
                          if(v instanceof MapView){
                              return true;
                          }
                          return super.canScroll(v, checkV, dx, x, y);
                      }
                  
                  }
                  

                  这将使地图忽略地图内的所有幻灯片,而只关心地图外的幻灯片/拖动.希望能帮助到你.(我现在为带有水平滚动的 webview 执行此操作)

                  This will make the map ignore all the slides inside the map and just care about the slides/draggs outside the map. Hope it helps. (I do this right now for a webview with horizontal scroll)

                  忘了提到你需要在布局中使用 CustomViewPager 而不是 ViewPager.

                  Forgot to mention that instead of the ViewPager you need to use the CustomViewPager in yout layout.

                  <com.yourpackage.CustomViewPager
                              android:id="@+id/viewpager"
                              android:layout_width="fill_parent"
                              android:layout_height="fill_parent" 
                          />
                  

                  这篇关于viewpager 页面中 mapview 的手势问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
                  cocos2d-android: how to display score(cocos2d-android:如何显示分数)
                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  Android file copy(安卓文件拷贝)
                  Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)

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

                    <tbody id='SWYNJ'></tbody>
                • <legend id='SWYNJ'><style id='SWYNJ'><dir id='SWYNJ'><q id='SWYNJ'></q></dir></style></legend>
                    <bdo id='SWYNJ'></bdo><ul id='SWYNJ'></ul>
                    <i id='SWYNJ'><tr id='SWYNJ'><dt id='SWYNJ'><q id='SWYNJ'><span id='SWYNJ'><b id='SWYNJ'><form id='SWYNJ'><ins id='SWYNJ'></ins><ul id='SWYNJ'></ul><sub id='SWYNJ'></sub></form><legend id='SWYNJ'></legend><bdo id='SWYNJ'><pre id='SWYNJ'><center id='SWYNJ'></center></pre></bdo></b><th id='SWYNJ'></th></span></q></dt></tr></i><div id='SWYNJ'><tfoot id='SWYNJ'></tfoot><dl id='SWYNJ'><fieldset id='SWYNJ'></fieldset></dl></div>
                          <tfoot id='SWYNJ'></tfoot>