Android导航抽屉显示在API=4.1上的效果很好。我做了一个变通方法,这样我就不会被阻止了,那就是在旧API的抽屉上设置一个触摸监听器 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ActivityUtils.requestFullscreen(this); // setContentView(R.layout.activity_main); // // FrameLayout frameLayout = (FrameLayout) findViewById(R.id.container); FrameLayout.LayoutParams params = BaseGameActivity.createSurfaceViewLayoutParams(); // new FrameLayout.LayoutParams( // LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); this.mRenderSurfaceView = new RenderSurfaceView(this); this.mRenderSurfaceView.setRenderer(this.mEngine, this); mRenderSurfaceView.setLayoutParams(params); frameLayout.addView(mRenderSurfaceView); frameLayout.setBackgroundColor(Color.BLACK); // this.setContentView(this.mRenderSurfaceView, // BaseGameActivity.createSurfaceViewLayoutParams()); // if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { mRenderSurfaceView.setPreserveEGLContextOnPause(true); } // // mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById( R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); }
我正在尝试将Andengine的mRenderSurfaceView与标准的android应用程序结合起来。 我创建了一个带有导航抽屉的标准Android项目,并成功地插入了mRenderSurfaceView 问题:在安卓2.3和安卓4.0.3上,导航抽屉只有在被拉出时才会显示在mRenderSurfaceView下方。当抽屉完全打开时,它又回到了前面 你知道如何让抽屉一直在上面吗,即使是在被拉出的时候 XML布局Android导航抽屉显示在API=4.1上的效果很好。我做了一个变通方法,这样我就不会被阻止了,那就是在旧API的抽屉上设置一个触摸监听器 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // ActivityUtils.requestFullscreen(this); // setContentView(R.layout.activity_main); // // FrameLayout frameLayout = (FrameLayout) findViewById(R.id.container); FrameLayout.LayoutParams params = BaseGameActivity.createSurfaceViewLayoutParams(); // new FrameLayout.LayoutParams( // LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); this.mRenderSurfaceView = new RenderSurfaceView(this); this.mRenderSurfaceView.setRenderer(this.mEngine, this); mRenderSurfaceView.setLayoutParams(params); frameLayout.addView(mRenderSurfaceView); frameLayout.setBackgroundColor(Color.BLACK); // this.setContentView(this.mRenderSurfaceView, // BaseGameActivity.createSurfaceViewLayoutParams()); // if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { mRenderSurfaceView.setPreserveEGLContextOnPause(true); } // // mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById( R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); },android,layout,z-index,andengine,navigation-drawer,Android,Layout,Z Index,Andengine,Navigation Drawer,我正在尝试将Andengine的mRenderSurfaceView与标准的android应用程序结合起来。 我创建了一个带有导航抽屉的标准Android项目,并成功地插入了mRenderSurfaceView 问题:在安卓2.3和安卓4.0.3上,导航抽屉只有在被拉出时才会显示在mRenderSurfaceView下方。当抽屉完全打开时,它又回到了前面 你知道如何让抽屉一直在上面吗,即使是在被拉出的时候 XML布局 <android.support.v4.widget.DrawerLa
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.epollomes.caniconnect.MainActivity" >
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<fragment
android:id="@+id/navigation_drawer"
android:name="com.epollomes.caniconnect.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
如果需要其他信息,请告诉我。
谢谢如果您直接用xml而不是java代码声明AndEngine RenderSurfaceView,会有什么区别吗?xml也是一样,奇怪的是API>=4.1上的效果很好。我做了一个变通方法,这样我就不会被阻止了,那就是在旧API的抽屉上设置一个触摸监听器
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// ActivityUtils.requestFullscreen(this);
//
setContentView(R.layout.activity_main);
//
//
FrameLayout frameLayout = (FrameLayout) findViewById(R.id.container);
FrameLayout.LayoutParams params = BaseGameActivity.createSurfaceViewLayoutParams();
// new FrameLayout.LayoutParams(
// LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
this.mRenderSurfaceView = new RenderSurfaceView(this);
this.mRenderSurfaceView.setRenderer(this.mEngine, this);
mRenderSurfaceView.setLayoutParams(params);
frameLayout.addView(mRenderSurfaceView);
frameLayout.setBackgroundColor(Color.BLACK);
// this.setContentView(this.mRenderSurfaceView,
// BaseGameActivity.createSurfaceViewLayoutParams());
//
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
mRenderSurfaceView.setPreserveEGLContextOnPause(true);
}
//
//
mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(
R.id.navigation_drawer);
mTitle = getTitle();
// Set up the drawer.
mNavigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));
}