我正在一個應用程序中,我在全屏和頂部的操作欄中獲取地圖。在行動欄中,我還包括了導航抽屜。一切正常,但Button沒有顯示到MapView上。
如果我刪除了抽屜式導航功能,則會顯示按鈕。但我的要求就像我應該能夠顯示欄上的按鈕以及導航欄。
如何獲得谷歌地圖上的按鈕字段
的片段是:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.mobile.android.ui.MapActivity"
tools:ignore="MergeRootFrame" >
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="List"
android:layout_marginRight="20dip"
android:layout_marginTop="20dip"
android:layout_marginLeft="20dip"
android:layout_gravity="left|top" />
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:name="com.mobile.android.ui.NavigationDrawerFragment" />
</android.support.v4.widget.DrawerLayout>
</FrameLayout>
你看到這個帖子? http://stackoverflow.com/questions/14694119/how-to-add-buttons-at-top-of-map-fragment-api-v2-layout – 2014-10-07 12:59:14
是啊!我已經看到這篇文章..我得到的按鈕,如果我排除導航抽屜代碼!我的要求就像在我的屏幕上我希望導航抽屜和地圖上的按鈕......!@ Martin Pfeffer – anand 2014-10-07 13:01:38
嗯,我無法想象它應該如何工作。你的意思真的是指NavigationDrawer而不是ViewPager?如果NavigationDrawer顯示在屏幕的左側/右側,則焦點會丟失。 – 2014-10-07 13:05:38