Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

java - Google maps marker setVisible with clustering on Android

How to get marker options..

I really want to know how to solve the problem.

have been searching for hours. help...

I want the marker to disappear and visible when click the checkbox.

here is my code format:

Code

...

Customitem customitem;
ArrayList list1 = new ArrayList();
ArrayList list2 = new ArrayList();

ClusterManager<Customitem> mClusterManager;
mClusterManager = new ClusterManager<>(this, mMap);
CustomCluster renderer = new CustomCluster(this, mMap, mClusterManager);
mClusterManager.setRenderer(renderer);

for(int i = 0; i < 4; i++)
{
    Customitem customitem = new Customitem("No." + i + "Test Title", "Test Desc", 35 + i, 35 + i);
    if(i < 2) list1.add(mClusterManager.addItem(myitem));
    else list2.add(mClusterManager.addItem(myitem));
}

...

CheckBox checkBox1 = (CheckBox)findViewById(R.id.checkBox1);
CheckBox checkBox2 = (CheckBox)findViewById(R.id.checkBox2);
checkBox1.setOnClickListener(new CheckBox.OnClickListener()
{ ... More

  

Problem

CheckBox checkBox1 = (CheckBox)findViewById(R.id.checkBox1);
CheckBox checkBox2 = (CheckBox)findViewById(R.id.checkBox2);
checkBox1.setOnClickListener(new CheckBox.OnClickListener()
{
    @Override
    public void onClick(View v)
    {
        if (((CheckBox)v).isChecked())
        {
            for (int i = 0; i < list1.size(); i++)
            {
                Marker m = (Marker) list.get(i);
                m.setVisible(true);
            }
        else
        {
            for(int i = 0; i < list1.size(); i++)
            {
                Marker m = (Marker)list.get(i);
                m.setVisible(false);
            }
        }
    }
}

... checkbox2 click event same
question from:https://stackoverflow.com/questions/65914259/google-maps-marker-setvisible-with-clustering-on-android

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...