1
我希望有一個佈局,使得用戶可以ListView和MapView類和菜單按鈕點擊之間切換。當第一次創建活動時,它從服務器獲取數據並顯示列表結果,並在菜單按鈕上點擊地圖上的所有結果。 我遇到的問題是在用戶單擊刷新結果菜單按鈕後,最初和再次顯示加載屏幕。 我的佈局如下,活動擴展了MapActivity。我希望當調用notifyDataSetInvalidated()時列表數據變得可用時,加載視圖將消失。我在其他活動中使用了類似的邏輯,但沒有使用mapview,活動擴展了listactivity,它可以工作,但在這種情況下不起作用。的Android的ListView MapView的佈局問題
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<LinearLayout
android:id="@+id/data_view"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
>
<ListView
android:id="@android:id/list"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:drawSelectorOnTop="false"
android:scrollbars="vertical"
/>
<com.google.android.maps.MapView
android:id="@+id/map_view"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:clickable="true"
android:visibility="gone"
android:apiKey="@string/google_maps_api_key"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:background="@color/white"
>
<ProgressBar
android:id="@+id/emptyProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dip"
style="?android:attr/progressBarStyleSmall"
/>
<TextView
android:id="@+id/emptyText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/loading"
/>
</LinearLayout>
</LinearLayout>