gpt4 book ai didi

android - 删除 View 并重新创建它

转载 作者:太空宇宙 更新时间:2023-11-03 10:55:40 26 4
gpt4 key购买 nike

有没有办法删除用

设置的 View
setContentView(R.layout.set_map_center);
mapView = (MapView) findViewById(R.id.mapview);

如果我再次调用此 View ,则会收到一条错误消息:

java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity

最佳答案

((ViewGroup)mapView.getParent()).removeView(mapView);

关于android - 删除 View 并重新创建它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5216470/

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