我在Fragment中实现Google Map时遇到了麻烦.
这是我的片段类的一部分:
public class FragmentStoreFinderMap extends Fragment implements OnMapReadyCallback {
// Google Map
private GoogleMap googleMap;
private int i;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
googleMap = ((SupportMapFragment)getActivity().getSupportFragmentManager().findFragmentById(
R.id.map)).getMapAsync(this);
Run Code Online (Sandbox Code Playgroud)
我在getMapAsync(this)中收到错误.我告诉不兼容的类型.
它说:
必需:com.google.android.gms.map.GoogleMap
发现:无效
顺便说一句,这是我的xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment class="com.google.android.gms.maps.SupportMapFragment"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) android google-maps android-fragments supportmapfragment android-studio
我正在开发一个 android 应用程序。我需要用图像填充我的列表。我想使用数组在表格布局中逐行插入图像。你能指导我怎么做吗?谢谢你。