Когда я передвигаюсь по карте а потом убираю палец карта смещаться на пол сантиметра. Как избавиться от этого?
MainActivity.java:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView myWebView = (WebView) findViewById(R.id.webview); WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); try { InputStream is = getAssets().open("MyLication.html"); byte[] buffer = new byte[is.available()]; is.read(buffer); is.close(); String htmlText = new String(buffer); myWebView.loadDataWithBaseURL( "http://com.d_code.webview.ymapapp", htmlText, "text/html", "UTF-8", null ); } catch (IOException e) { e.printStackTrace(); } }
MyLication.html:
<!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MyLocation</title> <script src="//api-maps.yandex.ru/2.0/?load=package.standard&lang=ru-RU" type="text/javascript"></script> <script type="text/javascript"> ymaps.ready(init); function init () { new ymaps.Map('map', { center:[52.076015,23.723014], zoom:18 }, { suppressMapOpenBlock: true }); } </script> <style type="text/css"> html, body, #map { width: 100%; height: 100%; margin: 0; padding: 0; } </style> </head> <body> <div id="map"></div> </body> </html>
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.d_code.webview.MainActivity"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center" android:clickable="false" android:contextClickable="false" android:focusable="false" android:focusableInTouchMode="false" /> </RelativeLayout> </android.support.design.widget.CoordinatorLayout>