2013年8月24日星期六

android surfaceview how to change the video window size?

I wrote a class that inherits surfaceview class to implement video playback. In using the MediaPlayer class to control playback. Then in the activity in to use this class. Surfaceview but found the size of the screen can be controlled, but the size of the video window, but not control, how to solve it?
surfaceview size
LayoutParams lp = surfaceView.getLayoutParams ();
lp.width = 1280;
lp.height = 720;
surfaceView.setLayoutParams (lp);
In
@ Override
public void surfaceChanged (SurfaceHolder surfaceHolder, int arg1, int w, int h) {
mediaPlayer.setDisplay (surfaceHolder);
}
------ Solution ----------------------------------- ---------
surfaceView.getHolder (). setFixedSize (?,?); This can be controlled.
------ Solution ---------------------------------------- ----
written in oncreate function in
------ Solution ---------------------------- ----------------
surfaceView.getHolder (). setFixedSize
------ reference -------------- -------------------------
@ Override
public void surfaceChanged (SurfaceHolder surfaceHolder, int arg1, int w, int h) {
surfaceHolder.setFixedSize (?,?);
mediaPlayer.setDisplay (surfaceHolder);
}
so I tried. Seemingly not
------ reference -------------------------------------- -
@ Override
public void surfaceChanged (SurfaceHolder surfaceHolder, int arg1, int w, int h) {
surfaceHolder.setFixedSize (w, h);
mediaPlayer.setDisplay (surfaceHolder);
}
that I used, seemingly not
------ reference ----------------------------- ----------
LayoutParams lp = surfaceView.getLayoutParams ();
lp.width = 1280;
lp.height = 647;
surfaceView.getHolder (). setFixedSize (1280, 647);
surfaceView.setLayoutParams (lp);
Do not do it
------ reference --------------------------------- ------
my needs is both a small-screen playback, but also a full-screen playback, switchable. Cut from full screen to small screen playback, surfaceView smaller, but the video is kind of full-screen playback, we can only see part of. Heroes Yeah, this how to get
------ reference --------------------------------- ------
surfaceHolder.setFixedSize (?,?); is to set the resolution, the size of the video window size is determined by the surfaceView. Just set surfaceView the layout on the line, because I did not use before using the machine in question, for these machines on the line. Was done
------ reference ------------------------------------ ---
SurfaceView sView;
sView.setLayoutParams (new RelativeLayout.LayoutParams (int w, int h));
------ reference -------------- -------------------------
recently, get this, the landlord can give me what parts of the code, it does not know how to engage
------ reference - --------------------------------------
I also do this, can also send me a reference to the next. Thank
------ reference ---------------------------------------
thank you

没有评论:

发表评论