Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android-在暂停时删除Google地图片段并在恢复时重新添加_Android_Google Maps_Android Fragments_Onresume_Onpause - Fatal编程技术网

Android-在暂停时删除Google地图片段并在恢复时重新添加

Android-在暂停时删除Google地图片段并在恢复时重新添加,android,google-maps,android-fragments,onresume,onpause,Android,Google Maps,Android Fragments,Onresume,Onpause,我需要删除活动onPause事件上的Google地图片段,并将其添加回Resume事件。我该怎么做 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="matc

我需要删除活动onPause事件上的Google地图片段,并将其添加回Resume事件。我该怎么做

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/mapContainer"
    tools:context=".MainActivity" >

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>

因此

需要它

编辑:

实际上是我做的。但是仍然有延迟问题。如何在后台停止/关闭意图?

编辑:


另外,我正在尝试删除并添加回片段,请参见此->

我刚刚删除了选项卡视图。现在速度真的很快。如果您在像我这样的情况下担心性能,我建议您删除tabhost并使用new Intent()。

我刚刚删除了tabview。现在速度真的很快。如果您担心在像我这样的情况下的性能,我建议您删除tabhost并使用new Intent()。

我有一个问题,您如何删除tabhost?只需将其替换为活动,一个用于加载,多个用于制表符。您有一个示例是什么意思?抱歉,我无法用示例解释,但基本上我的意思是只删除TabHost控件并仅使用Activities。我有一个问题,您如何删除TabHost?只需将其替换为Activities,一个用于加载,多个用于选项卡。你的意思是什么?你有一个示例吗?对不起,我不能用示例来解释,但基本上我的意思是删除TabHost控件,只使用活动。