3

我有一个非常不典型的问题,我为此使用容器(RelativeLayout)在 CameraView(SurfaceView)上覆盖了一个 AnimationView(RelativeLayout),但是在 CameraView 之后显示的 AnimationView 剪切添加

这是我的活动 onCreate 代码:

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);

    RelativeLayout container = (RelativeLayout) findViewById(R.id.container);

    cameraView = new CameraView(this);
    RelativeLayout.LayoutParams surfaceLayoutParams = new RelativeLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    cameraView.setLayoutParams(surfaceLayoutParams);
    container.addView(cameraView);

    animationView = new AnimationView(this);
     RelativeLayout.LayoutParams relativeLayoutParams = new RelativeLayout.LayoutParams(
                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
     animationView.setLayoutParams(relativeLayoutParams);

    container.addView(animationView);

    animationView.startAnimation();
}

并显示切割 AnimationView:http ://s13.postimage.org/d62piuko7/Untitled.png

但是当不添加 CameraView 时,动画效果很好:http ://s18.postimage.org/sycfdq2mx/Untitled2.png

4

0 回答 0