Hello World im new programming...
i am creating a trip app...
i have an Activity with LinearLayout that contains 6 ImageButtons, and after the LinearLayout there is a FrameLayout with Google Maps; in the logical part there are 6 Polylines, all of these Polylines have.visible(false)
i would like click in 1 ImageButton and get 1 Polyline set.visible(true) and if i click again the ImageButton set that Polyline.visible(false)
thanks in advance!!!
I use this code to my Zoom Buttons but i do not know how configure them to change visibility on polylines...
public class TransBus extends AppCompatActivity implements OnMapReadyCallback {
ImageButton busBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_trans_bus);
//Hooks
busBtn = findViewById(R.id.bus1);
busBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) { visibilityOn(); }
});
SupportMapFragment supportMapFragment = SupportMapFragment.newInstance();
getSupportFragmentManager().beginTransaction().add(R.id.container, supportMapFragment).commit();
supportMapFragment.getMapAsync(this);
}
public void visibilityOn() {?
}
You can use the setVisibility() method of polylineOptions defined in the android sdk .
You can change the visibility by calling this code on the polyline object
polyline.setVisibility(false)
if you want to check out other methods you can check the documentation
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.