美文网首页
Android开发遇到的问题

Android开发遇到的问题

作者: 狠狠狠努力的疯子 | 来源:发表于2021-04-15 15:38 被阅读0次

    1.GLSurfaceView把上层的View遮盖

    在使用GLSurfaceView开发的时候,会调到到setZOrderOnTop(boolean onTop)这个方法,而这个方法大概的意思是将GLSurfaceView放置到window界面的最上层,所以GLSurfaceView上面是不会显示其他View的。下面这个段是官方对这个方法的介绍。

    Control whether the surface view's surface is placed on top of its window. Normally it is placed behind the window, to allow it to (for the most part) appear to composite with the views in the hierarchy. By setting this, you cause it to be placed above the window. This means that none of the contents of the window this SurfaceView is in will be visible on top of its surface.
    
    Note that this must be set before the surface view's containing window is attached to the window manager. If you target `[Build.VERSION_CODES#R](https://developer.android.google.cn/reference/android/os/Build.VERSION_CODES#R)` the Z ordering can be changed dynamically if the backing surface is created, otherwise it would be applied at surface construction time.
    
    Calling this overrides any previous call to [setZOrderMediaOverlay(boolean)](https://developer.android.google.cn/reference/android/view/SurfaceView#setZOrderMediaOverlay(boolean)).
    
    

    在这段官方介绍的最后提到了setZOrderMediaOverlay(boolean isMediaOverlay)这个方法,下面是setZOrderMediaOverlay的官方介绍,这段介绍不太好理解,根据我自身的使用和理解,这段介绍的意思是调用setZOrderMediaOverlay方法后,GLSurfaceView依然会显示在最上面,只是会在对应的位置开一个口显示需要置顶的View。

    Control whether the surface view's surface is placed on top of another regular surface view in the window (but still behind the window itself). This is typically used to place overlays on top of an underlying media surface view.
    
    Note that this must be set before the surface view's containing window is attached to the window manager.
    
    Calling this overrides any previous call to `[setZOrderOnTop(boolean)](https://developer.android.google.cn/reference/android/view/SurfaceView#setZOrderOnTop(boolean))`.
    
    

    2.使用Arrays将数组转集合,再进行添加或移除的时候报UnsupportedOperationException错误

    在Arrays类里面有一个自定义的ArrayList类,而这个类并没有实现add和remove方法,在AbstractList类中,这个两个方法直接抛出UnsupportedOperationException错误,所以在使用Arrays的asList方法的时候要注意得到的ArrayList集合并不是我们平时使用java.util.ArrayList类得到的集合

    3.Type BuildConfig is defined multiple times

    在多模块开发的时候,如果AndroidManifest.xml文件中的package相同则会导致出现这个问题。

    相关文章

      网友评论

          本文标题:Android开发遇到的问题

          本文链接:https://www.haomeiwen.com/subject/eccrnktx.html