I have a FrameLayout in my application and in the xml file its width
and height
is set to wrap_content
. then I want to change its dimensions programmatically like this :
FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
ViewGroup.LayoutParams previewParam = preview.getLayoutParams() ;
previewParam.height =(int) (height * 0.86);
previewParam.width = (int)(previewParam.height/ratio) ;
preview.setLayoutParams(previewParam) ;
When I do this the program exits when I start this activity, is the problem with wrap_content
or not ?