我对SlidingDrawer
动画有一些问题。
我有View
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:id="@+id/rlGL"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</RelativeLayout>
<SlidingDrawer
android:id="@+id/slidingDrawer1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:topOffset="900dp"
android:content="@+id/content"
android:handle="@+id/handle"
android:orientation="horizontal"
android:animateLayoutChanges="false">
<ImageView
android:id="@+id/handle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/add" />
<LinearLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:measureWithLargestChild="true"
android:orientation="vertical"
android:background="#171717">
<Button
android:id="@+id/bOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ok"
android:textSize="48sp">
</Button>
</LinearLayout>
</SlidingDrawer>
</FrameLayout>
这个“空”RelativeLayout
我用于SurfaceView
(用于相机预览)和GLSurfaceView
(用于具有透明背景的OpenGL场景)。有一个代码:
...
setContentView(R.layout.activity_main);
relLayout = (RelativeLayout) findViewById(R.id.rlGL);
mGLSurfaceView = new MyGlSurfaceView(this);
mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
relLayout.addView(mGLSurfaceView, new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
preview = new SurfaceView(this);
surfaceHolder = preview.getHolder();
surfaceHolder.addCallback(this);
relLayout.addView(preview, new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT));
...
问题是,点击抽屉的手柄图像后,它会消失片刻(动画运行时),然后出现在打开状态。为什么会这样?