Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change custom surfaceView width and height

Tags:

android

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

like image 771
Kamran Omar Avatar asked Nov 02 '10 12:11

Kamran Omar


2 Answers

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);
like image 163
x_lunatic Avatar answered Oct 21 '22 20:10

x_lunatic


This is the right way to do it :

surfaceView.getHolder().setFixedSize(width, height);
like image 20
anass Avatar answered Oct 21 '22 21:10

anass