gpt4 book ai didi

android - NestedScrollView 内的 MapView 滚动不流畅

转载 作者:行者123 更新时间:2023-12-05 00:09:12 26 4
gpt4 key购买 nike

<分区>

我对 NestedScroollView 中的 MapView 有疑问。我的 Google map 显示正确,但是当我尝试滚动 map 时它不起作用。我不知道如何解决这个问题。谁能帮我?谢谢!

这是我的代码:狗_view.xml

...
<android.support.v4.widget.NestedScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/nestedScroll"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<include layout="@layout/dog_view_layout"
android:layout_height="match_parent"
android:layout_width="match_parent"/>

</android.support.v4.widget.NestedScrollView>

dog_view_layout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:background="#000"
android:layout_height="wrap_content"
android:paddingTop="20dp">
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</RelativeLayout>

狗 fragment

...
MapView mMapView;
private GoogleMap googleMap;


public DogFragment(){

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.dog_view, container, false);
this.dog = getArguments().getParcelable("data");
mMapView = (MapView) rootView.findViewById(R.id.mapView);
mMapView.onCreate(savedInstanceState);
mMapView.onResume(); // needed to get the map to display immediately
try {
MapsInitializer.initialize(getActivity().getApplicationContext());
} catch (Exception e) {
e.printStackTrace();
}

mMapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap mMap) {
googleMap = mMap;
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
googleMap.setMyLocationEnabled(true);
}
});
setLayout(rootView);
return rootView;
}
.....
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com