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

How to make center align child div

 How to make center align child div?   Suppose you have 2 Div tag. And want the make inner tag center <div id="d1">      ...

Ads Inside Post

Powered by Blogger.

Arsip