DrawerLayout的ListView不GLSurfaceView绘制内容 [英] DrawerLayout ListView not drawn with GLSurfaceView as content

查看:360
本文介绍了DrawerLayout的ListView不GLSurfaceView绘制内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid应用程序是全屏的OpenGL ES 2.0的应用程序,因此主要内容是GLSurfaceView的自定义扩展。
活动的布局是这样的:

My Android app is a fullscreen OpenGL ES 2.0 app, so the main content is a custom extension of GLSurfaceView. The activity layout looks like this:

<android.support.v4.widget.DrawerLayout
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:id="@+id/drawer_layout">
    <FrameLayout android:id="@+id/content_frame"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent" />
    <ListView android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        android:background="#111" />
</android.support.v4.widget.DrawerLayout>

然后我用的FrameLayout的addView方法添加我的GLSurfaceView。
如果我不这样做,抽屉按预期工作。

I then add my GLSurfaceView using the addView method of the FrameLayout. If i don't do this, the Drawer works as expected.

ListView控件似乎当我刷卡它被正确地拉出,因为直到我刷卡回左边我不能与GLSurfaceView互动了。但它并不显示出来,就像是GLSurfaceView呈现永诺的ontop它。

The ListView seems to be pulled out correctly when i swipe it in, as i can't interact with the GLSurfaceView anymore until i swipe it back to the left. But it's not displayed at all, like the GLSurfaceView is allways rendered ontop of it.

我如何获得一个DrawerLayout与GLSurfaceView工作作为它的内容?

How do i get a DrawerLayout working with a GLSurfaceView as its content?

推荐答案

我刚刚遇到了同样的问题,我发现一个相当愚蠢的解决方法吧。这个问题似乎只影响DrawerLayouts,而不是常规视图。所以,简单地将一个空查看在你GLSurfaceView,以掩盖它从抽屉了。

I've just faced the same problem, and I've found quite a silly workaround for it. This issue seems to only affect DrawerLayouts, and not regular Views. So simply place an empty View over your GLSurfaceView, to mask it away from the Drawer.

下面是我剥了下来布局文件作为你的例子:

Here's my stripped down layout file as a sample for you:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawerLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <GLSurfaceView
            android:id="@+id/glSurfaceView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

        <View 
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </RelativeLayout>


    <FrameLayout
        android:id="@+id/frameLayoutDrawer"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="end"
        android:background="@android:color/white" />
</android.support.v4.widget.DrawerLayout>

这篇关于DrawerLayout的ListView不GLSurfaceView绘制内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆