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>