在SurfaceView上使用ViewAnimator会导致出现问题

时间:2010-10-18 05:50:46

标签: android

我似乎对普通视图和SurfaceViews没有任何好运。我有一个带有两个孩子的FrameLayout,一个glSurfaceView和一个ViewAnimator。目的是为菜单,选项等提供顶部按钮的背景渲染。当我从ViewAnimator动画时,它们会按原样移动但看起来它们会在某些东西下滚动,就像它们被部分遮盖一样(遮罩区域似乎与视图的大小有关)。如果我删除glSurfaceView它的行为正确(即使SurfaceView中的onDraw只做一个glClear)。我正要放弃并完全采取另一种方法,但我想我是否有人问过这个问题。

主xml

<FrameLayout    android:id="@+id/FrameLayout01"
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">

<include android:id="@+id/glrender"  layout="@layout/glview" />
<include android:id="@+id/guiscreens"  layout="@layout/viewflipper" />

</FrameLayout>

gl视图

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

    <android.opengl.GLSurfaceView 
                    android:id="@+id/glsurfaceview" 
                    android:layout_width="fill_parent" 
                    android:layout_height="fill_parent"/> 

</FrameLayout>

观点动画师

<ViewAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

    <include android:id="@+id/first"  layout="@layout/mainmenu" />
    <include android:id="@+id/second"  layout="@layout/otherscreen" />

</ViewAnimator>

其中一个观点

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

    <Button android:id="@+id/Button01"
        android:text="CLICK ME"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content">
    </Button>

</LinearLayout>

我阅读了文档,我认为我已经解决了所有问题,但我想我错过了一些东西。我在演示中找不到任何完全正在尝试的样本。感谢任何意见,谢谢!

1 个答案:

答案 0 :(得分:1)

如果使用平移,缩放或旋转动画,当前动画系统可能无法在SurfaceView上正常工作。这将是未来将要解决的问题。

相关问题