开发者

android listview mapview layout issue

I want a layout such that user can toggle between listview and mapview and menu button click. When the activity is first created it fetches data from server and display list result and upon menu button click maps all result on mapview. The problem I am having is displaying the loading screen initially and again after user click refresh result menu button. My layout is below, activity extends MapActivity. I expect loading view to be gone when list data becomes available of when notifyDataSetInvalidated() is called. I have used similar logic in other activity without mapview and activity extends listactivity and it works but not in this case.

<?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="开发者_如何学Gowrap_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>


I have decided to use FrameLayout and switch between these 3 views based on what to display.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜