2

内部に線形レイアウトのスクロールビューがあります。このlinearlayout内の要素の1つは、glsurfaceviewです。

これはすべて正しく機能し、スクロールするとglsurfaceviewが上下に移動しますが、glsurfaceviewがスクロールビューの本来あるべき位置の上部または下部に到達すると、クリップされるべきではなく、スクロールビューの外側に続きます。このスクリーンショットはそれをより明確にするはずです:

glsurfaceviewが正しくクリップされていません

完全に必要だとは思わないが、これが私のlayout.xmlです。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical"
android:padding="6dip"
>
<ScrollView
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
>
    <LinearLayout
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"
    >
        <LinearLayout
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:orientation="horizontal"
        >
            <LinearLayout
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:orientation="vertical"
            android:layout_weight="1"
            >
            <!-- LOTS OF SEEKBARS/TEXTVIEWS -->
            </LinearLayout>
            <LinearLayout
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content" 
                android:layout_weight="1.4"
                android:layout_marginRight="10dip"
                android:layout_marginLeft="10dip"
                android:orientation="horizontal" >
                <android.opengl.GLSurfaceView android:id="@+id/glview"  
                android:layout_width="100px"
                android:layout_height="250px"/>
            </LinearLayout>
        </LinearLayout>

        <LinearLayout
        android:layout_marginTop="6dip"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_weight="1"
        android:orientation="horizontal" >
            <!-- OK/CANCEL BUTTONS -->
        </LinearLayout>
    </LinearLayout>
</ScrollView>
</LinearLayout>

すべてが大いに感謝します:)

4

3 に答える 3

4

ScrollView(またはListviewなど)内でのSurfaceViewのホスティングは現在サポートされていません。

于 2011-02-27T21:14:11.367 に答える
0

それは、お辞儀をしたようにサポートについてではありません。問題の原因はGLSurfaceView、ビューレベルにないことです。要するに:あなたの場合、あなたはGLSurfaceView最初のレベルにあり、次にビュー内の他のビューがholesありますGLSurfaceView (これはウィンドウマネージャーによって処理され、xmlをどこに置くかは重要ではありませんGLSurfaceView、それはどのような場合でも最初のレベルになり、他のビューは次のレベル)

したがって、必要なのはビューの更新を強制することであり、回避策があります。スクロールをGLSurfaceViewまたは(RecyclerView with GLSurfaceViews)の「間に」2つ配置する必要がありますFrameLayouts。このようなもの:

<?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>
于 2019-07-08T14:18:21.427 に答える
0

オーバースクロールを削除するには、以下の行を使用できます。

glView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
glView.setZOrderOnTop(true);
glView.setZOrderMediaOverlay(true); 

そして黒い背景を取り除くために:

linearLayout.setBackgroundColor(context.getResources().getColor(R.color.white));
linearLayout.addView(glView);

また、マニフェストファイルに以下の行を追加します。

android:hardwareAccelerated="true"
于 2020-12-07T05:53:20.723 に答える