导航抽屉并不总是在顶部

时间:2014-11-21 05:00:09

标签: android android-fragments navigation-drawer

有没有办法让导航抽屉保持在所有Fragment之上或停止响应,以便在Fragment位于顶部时不会滑动

enter image description here

正如您在图片中看到的那样,即使在地图顶部调用紫色Fragment Fragment

,白色导航抽屉仍会响应

代码:

// Setup NavigationDrawer list
listView1 = (ListView) findViewById(R.id.left_drawer);
LDrawerNames = getResources().getStringArray(
        R.array.drawerList_activityMap_navigationDrawer);
navDrawerAdapter = new NavigationDrawerAdapter(this, LDrawerNames);
listView1.setAdapter(navDrawerAdapter);
listView1.setOnItemClickListener(this);

// DrawerLayout & Listener
LDrawerLayout = (DrawerLayout) findViewById(R.id.whole_map_layout);
LDrawerListener = new ActionBarDrawerToggle(this, LDrawerLayout,
        R.drawable.ic_drawer, R.string.navigation_drawer_open) {
    @Override
    public void onDrawerClosed(View drawerView) {
        super.onDrawerClosed(drawerView);
        invalidateOptionsMenu();
    }

    @Override
    public void onDrawerOpened(View drawerView) {
        super.onDrawerOpened(drawerView);
        invalidateOptionsMenu();
    }

};
LDrawerLayout.setDrawerListener(LDrawerListener);

map.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.xxxx.xxxx.Map" >

    <android.support.v4.widget.DrawerLayout
        android:id="@+id/whole_map_layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clipToPadding="false"
        android:fitsSystemWindows="true" >

        <!-- TODO: Update blank fragment layout -->

        <RelativeLayout
            android:id="@+id/mainContent"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <fragment
                android:id="@+id/fragment_map"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                class="com.google.android.gms.maps.SupportMapFragment" />

            <include layout="@layout/toolbar" />

            <com.xxxx.xxxx.util.CircleImageView
                android:id="@+id/Map_addPartyButton"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:layout_alignParentBottom="true"
                android:layout_alignParentRight="true"
                android:clickable="true" />
        </RelativeLayout>

        <include layout="@layout/navigationdrawer"/>
    </android.support.v4.widget.DrawerLayout>

</FrameLayout>

0 个答案:

没有答案