如何更改自定义surfaceView的宽度和高度 [英] how to change custom surfaceView width and height

查看:3763
本文介绍了如何更改自定义surfaceView的宽度和高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能更改自定义SurfaceView的宽度和高度。 这可能吗?

How can i change custom SurfaceView width and height. is this possible?

推荐答案

我有同样的问题。但是,这绝对应该工作,只需要检查什么样的LaoutParams你正在设置。我有同样的问题,因为我使用FrameLaoutPrams代替的LayoutParams。我需要这样设置:

I had the same problem. But this should definitely work, just need to check what kind of LaoutParams you are setting. I had the same problem because I am using FrameLaoutPrams instead LayoutParams. I needed to set it like this :

    android.widget.FrameLayout.LayoutParams params = new android.widget.FrameLayout.LayoutParams(width, height);
    surface.setLayoutParams(params);

这篇关于如何更改自定义surfaceView的宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆