Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 导航抽屉不总是在上面_Android_Android Fragments_Navigation Drawer - Fatal编程技术网

Android 导航抽屉不总是在上面

Android 导航抽屉不总是在上面,android,android-fragments,navigation-drawer,Android,Android Fragments,Navigation Drawer,有没有办法让导航抽屉位于所有Fragment的顶部,或者停止它的响应,这样当Fragment位于顶部时它就不会滑动 如图所示,即使在地图片段顶部调用紫色片段时,白色导航抽屉仍会响应 代码: // Setup NavigationDrawer list listView1 = (ListView) findViewById(R.id.left_drawer); LDrawerNames = getResources().getStringArray( R.array.drawer

有没有办法让导航抽屉位于所有
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>


没有。。。没有使用此技巧:/“…或停止其响应以使其不会滑动…”-您可以使用
DrawerLayout\#setDrawerLockMode()
方法在需要时锁定抽屉。好主意。。。谢谢,先生