0
我想在我的應用程序中使用兩個地圖,我只有一個活動和幾個片段顯示在不同的選項卡中。我有一個片段,其中地圖覆蓋整個佈局,另一個片段只是佈局的一小部分。在App中使用兩個Google地圖v2對象
第一個工作正常,但添加第二個地圖會導致我的應用崩潰,導致通貨膨脹異常。
這裏是xml佈局。
拳XML 1
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff"
android:focusable="true"
android:focusableInTouchMode="true" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@color/grey"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/search_bar"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp" >
<ImageButton
android:id="@+id/button3"
android:layout_width="@dimen/title"
android:layout_height="@dimen/title"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="@drawable/search"
android:contentDescription="@string/search" />
<AutoCompleteTextView
android:id="@+id/location_search"
android:layout_width="wrap_content"
android:layout_height="@dimen/etext_height"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/search_cancel"
android:layout_toRightOf="@+id/button3"
android:background="#00ffffff"
android:hint="@string/search_msg"
android:inputType="text"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:popupBackground="@drawable/drop_down_bg"
android:textColor="@color/text_grey"
android:textSize="@dimen/stat_tx" >
</AutoCompleteTextView>
<Button
android:id="@+id/search_cancel"
android:layout_width="@dimen/title"
android:layout_height="@dimen/title"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@drawable/pop_up_close" />
</RelativeLayout>
</RelativeLayout>
<FrameLayout
android:id="@+id/frameline"
android:layout_width="wrap_content"
android:layout_height="2dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/relativeLayout1"
android:background="@color/light_pink" >
</FrameLayout>
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/frameline"
class="com.app.custom.views.TransparentSupportMapFragment" />
XML 2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/grey"
android:paddingTop="3dp" >
<FrameLayout
android:id="@+id/frameLayout13"
android:layout_width="wrap_content"
android:layout_height="0.5dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@color/divider" >
</FrameLayout>
<FrameLayout
android:id="@+id/frameLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/frameLayout13"
android:background="@drawable/title_bg" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="10dp"
android:text="@string/description"
android:textColor="@color/text_grey"
android:textSize="@dimen/event_list_text_large" />
</FrameLayout>
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/bottom_frame"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/frameLayout1" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/linearLayout1"
android:layout_alignRight="@+id/linearLayout1"
android:layout_below="@+id/linearLayout1"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp" >
<TextView
android:id="@+id/club_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/linearLayout1"
android:layout_below="@+id/relativeLayout1"
android:textColor="@color/light_pink"
android:textIsSelectable="false"
android:textSize="@dimen/event_list_text_large" />
<TextView
android:id="@+id/show_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/event_name"
android:layout_marginTop="-3dp"
android:textColor="@color/text_grey_dark"
android:textIsSelectable="false"
android:textSize="@dimen/event_list_text_large" />
<TextView
android:id="@+id/event_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/club_name"
android:paddingTop="4dp"
android:textColor="@color/text_grey_dark"
android:textIsSelectable="false"
android:textSize="@dimen/event_list_text_large" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:orientation="vertical" >
<TextView
android:id="@+id/event_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:textColor="@color/text_grey_dark"
android:textIsSelectable="false"
android:textSize="@dimen/title"
android:textStyle="bold" />
<TextView
android:id="@+id/event_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:textColor="@color/light_pink"
android:textIsSelectable="false"
android:textSize="@dimen/event_list_text_small" />
<TextView
android:id="@+id/event_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="-3dp"
android:drawableLeft="@drawable/clock"
android:drawablePadding="5dp"
android:textColor="@color/light_pink"
android:textIsSelectable="false"
android:textSize="@dimen/event_list_text_small" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="@dimen/event_row_height2"
android:layout_alignLeft="@+id/relativeLayout1"
android:layout_alignRight="@+id/relativeLayout1"
android:layout_below="@+id/venue_address"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:background="#fff" >
<fragment
android:id="@+id/map22"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="-50dp"
android:layout_marginRight="-50dp"
class="com.fixr.custom.views.TransparentSupportMapFragment" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
是它使用兩個地圖,因爲它是用一個或相同的過程是有什麼不同的我需要做的。
對不起,你一定有一個錯字,我不能在一個? – Amanni
我已決定使用谷歌地圖v3。感謝您的幫助 – Amanni
沒有probs。我有一些錯誤的MD格式,它應該現在正確讀取 –