Using a ViewAnimator with a glSurfaceView does not animate
I have a ViewAnimator setup to go through a few normal views (buttons, text, etc) and then to a glSurfaceView. When animating between the normal views it behaves as expected, however when trying to flip to the glSurfaceView it just appears. Perhaps it is not possible to animate a glSurfaceView.
Here is how I setup the ViewAnimator
<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" />
<inc开发者_运维知识库lude android:id="@+id/third" layout="@layout/glview" />
</ViewAnimator>
Here is the problematic glSurfaceView
<LinearLayout 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"/>
</LinearLayout>
How I setup the views in code
setContentView(R.layout.main);
glSurface = (GLSurfaceView)findViewById(R.id.glsurfaceview);
renderer = new Renderer(this);
glSurface.setRenderer(renderer);
Beyond that I just use showNext() and showPrevious off the ViewAnimator, and it works great, until I try and switch to that glSurfaceView. Thanks for any input, i've been banging my head on this for longer than I would care to admit :)
SurfaceViews cannot be animated like other views. It is just not supported.
精彩评论