For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Thursday, December 25, 2014

change SurfaceView height width

Problem:

change SurfaceView height width in android.
You are using SurfaceView to open camera in Android. and want to set it's custom height and width. So How can you change SurfaceView height width?

Solution:

To change SurfaceView's custom height and width use "android.view.ViewGroup.LayoutParams"
There are subclasses of LayoutParams for different subclasses of ViewGroup. For example, AbsoluteLayout has its own subclass of LayoutParams which adds an X and Y value.  By this you can change X and Y of SurfaceView 

Example:

Use below  code:
android.view.ViewGroup.LayoutParams avvglp = surfaceView.getLayoutParams();
avvglp.height=300;
avvglp .width=300;
surfaceView.setLayoutParams(avvglp);

To See more here:
http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html
Share:

0 comments:

Post a Comment

Image Zoom Hover Effect

 Image Zoom Hover Effect                                                                   Image zoom hover out effect                      ...

Ads Inside Post

Powered by Blogger.

Arsip