Displaying a Google Map Inside RecyclerView

I can’t use the google map inside RecyclerView. I need to show the card and give it some configurations.

<com.google.android.gms.maps.MapView
        android:id="@+id/map_view"
        android:layout_height="120dp"
        android:layout_width="match_parent"
        android:layout_marginTop="15dp"/>

My RecyclerView:

@Override
    public ShopInfoAdapter.ShopInfoViewHolder onCreateViewHolder(ViewGroup viewGroup) {
        View view = LayoutInflater.from(viewGroup.getContext())
                .inflate(R.layout.fragment_x, viewGroup,
                        false);
        MyHolder holder = new MyHolder(view);
        holder.mapView.getMapAsync(this);

        return holder;
    }

@Override
    public void onMapReady(GoogleMap googleMap) {
        if (mListener != null) {
            mListener.onMapClick(googleMap);
        }
    }

public interface ItemListener {
        void onMapClick(GoogleMap googleMap);
    }

Note: I am implementing an interface and the problem is not being implemented.

+4
source share
1 answer

The "map" consists of two parts: these are your settings, and the second part is a marker. The market can be installed inside your adapter and give it some values, such as latitude / longitude, information window, wtc

. / .. AsyncTask .

( , ..) RecyclerView http://www.101apps.co.za/index.php/articles/android-s-recyclerview-and-cardview-widgets.html mapview, , .

+2

Source: https://habr.com/ru/post/1605936/


All Articles