glsurfaceview inside a scrollview, moving but not clipping

拈花ヽ惹草 提交于 2019-11-29 16:31:24

Hosting SurfaceViews inside ScrollView (or Listview, etc.) is currently not supported.

It is not about support as answered abowe. The cause of issue is that GLSurfaceView is not on the view level. In short: for you case you have GLSurfaceView at the first level, then other views with holes in views abowe GLSurfaceView (this handles by windows manager, and it dosent matter where you put GLSurfaceView on xml, it will be on first level in any case and others views on next level)

So, what you need is to force view update, and there is work around: you should put scroll with GLSurfaceView or (RecyclerView with GLSurfaceViews) "between" two FrameLayouts. something like this:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout   
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent" >

     <ScrollView
        android:fillViewport="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

       ---- here should be linear layout with your glView, or RecyclerView instead if required ----
     </ScrollView>

   --- this frame also required: ---
   <FrameLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@android:color/transparent" />

</FrameLayout>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!