Android:服务的Windowmanager中的Navigationdrawer(滑动菜单)

Android:服务的Windowmanager中的Navigationdrawer(滑动菜单),android,service,slidingmenu,layoutparams,window-managers,Android,Service,Slidingmenu,Layoutparams,Window Managers,我正在编写一个应用程序,它必须从服务运行,才能在后台实现连续视频流。我尝试在其中实现导航抽屉,滑动菜单甚至可以通过从屏幕边缘滑动手指打开,但是无法通过openDrawer(…)或closeDrawer(…)进行切换,滑动菜单也无法正确打开。列表视图不是弹出菜单,而是慢慢地拖到手指后面,也不能再完全隐藏。这是服务的代码: public int onStartCommand(Intent intent, int flags, int startId) { super.onStartComm

我正在编写一个应用程序,它必须从服务运行,才能在后台实现连续视频流。我尝试在其中实现导航抽屉,滑动菜单甚至可以通过从屏幕边缘滑动手指打开,但是无法通过openDrawer(…)或closeDrawer(…)进行切换,滑动菜单也无法正确打开。列表视图不是弹出菜单,而是慢慢地拖到手指后面,也不能再完全隐藏。这是服务的代码:

public int onStartCommand(Intent intent, int flags, int startId) {
     super.onStartCommand(intent, flags, startId);
     wm = (WindowManager) getSystemService(WINDOW_SERVICE);
     params = new WindowManager.LayoutParams(width, height,
                    WindowManager.LayoutParams.TYPE_PRIORITY_PHONE, 8, -3);


     layout = (android.support.v4.widget.DrawerLayout) layoutInflater
            .inflate(R.layout.recording_service, null);

     leftDrawer = (ListView) layout.findViewById(R.id.left_drawer);


     adapter = new StableArrayAdapter(this, preferences.getString(
                COUNTRYCODE, getApplicationContext().getResources()
                        .getConfiguration().locale.getCountry()));

     leftDrawer.setAdapter(adapter);

     wm.addView(layout, params);
     return START_STICKY;
  }
下面是xml:

<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" >

<RelativeLayout
    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:background="@null"
    android:theme="@android:style/Theme.NoTitleBar"
    tools:context=".MainActivity" >

    <SurfaceView
        android:id="@+id/surfaceview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >
    </SurfaceView>


</RelativeLayout>

<ListView
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="end"
    android:background="#111"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp" />

非常感谢您的帮助