Open jmadaminov opened 6 years ago
Так как это событие перехватывает scrollview
11 нояб. 2017 г. 15:28 пользователь "jahongir9779" notifications@github.com написал:
карта скроллится только горизонтально а вверх и вниз нет.
<ru.yandex.yandexmapkit.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="300dip" android:apiKey="1234567890" android:tag="static" />
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yandexmobile/yandexmapkit-android/issues/296, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSEm7-xkhy_jBW-7IqD3JKd6yQXitGMks5s1ZL-gaJpZM4QaeZQ .
Ето понятно, но на пример на google maps можно поставить mapview.requestDisallowInterceptTouchEvent(true); и карта будет нормально скроллит внутри scrollview
Данное Api не поддерживается.
12 нояб. 2017 г. 7:15 пользователь "jahongir9779" notifications@github.com написал:
Ето понятно, но на пример на google maps можно поставить mapview. requestDisallowInterceptTouchEvent(true); и карта будет нормально скроллит внутри scrollview
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/yandexmobile/yandexmapkit-android/issues/296#issuecomment-343712314, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSEm8F8ppOwMLEWXYfj7EayxEt9IJoxks5s1nD5gaJpZM4QaeZQ .
Используйте этот класс вместо mapview
public class CustomMapView extends MapView {
private ViewParent mViewParent;
public CustomMapView(Context context) {
super(context);
}
public CustomMapView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomMapView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public void setViewParent(@Nullable final ViewParent viewParent) { //any ViewGroup
mViewParent = viewParent;
}
@Override
public boolean onInterceptTouchEvent(final MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
if (null == mViewParent) {
getParent().requestDisallowInterceptTouchEvent(true);
} else {
mViewParent.requestDisallowInterceptTouchEvent(true);
}
break;
case MotionEvent.ACTION_UP:
if (null == mViewParent) {
getParent().requestDisallowInterceptTouchEvent(false);
} else {
mViewParent.requestDisallowInterceptTouchEvent(false);
}
break;
default:
break;
}
return super.onInterceptTouchEvent(event);
}
}
карта скроллится только горизонтально а вверх и вниз нет.
<ru.yandex.yandexmapkit.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="300dip" android:apiKey="1234567890" android:tag="static" />