surface-view - android对第三方的SurfaceView设置形变无效
巴扎黑
巴扎黑 2017-04-17 16:08:39
0
3
473

android如何对第三方的SurfaceView设置形变效果。我目前项目中用到了一个第三方的控件,它内部是用SurfaceView来实现的,我想对这个控件设置形变效果,比如说是宽度变为原先的一半,设置代码如下:

surfaceView.setScaleY(0.5);

但是结果虽然整个控件的大小变化了,但是里面所绘制的内容并没有变化,依旧是保持比例的

巴扎黑
巴扎黑

reply all (3)
大家讲道理

You can try setting up surfaceView status monitoring

surfaceView.getHolder().addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { //这里设置显示内容尺寸 holder.setFixedSize(width, height); } @Override public void surfaceDestroyed(SurfaceHolder holder) { } }); surfaceView.setScaleY(0.5);
    黄舟

    Segmentfault is out of order?

      黄舟

      Hello, I also have the same problem as you. The deformation setting of the third-party SurfaceView is invalid.
      How did you solve the problem of setting the size of SurfaceView and the size of the internal content?

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!