VideoView控件可以手动改变大小
2014-12-05 15:19
148 查看
Android中的videoview控件在android中不能设置宽高,需要重写videoView中的onMeasure()方法,才可以设置videoview的宽和高。重写的videoview代码如下:
让VideoView可以手动的设置长宽
让VideoView可以手动的设置长宽
/** * The CustomVideoView is to make videoView view length-width based on the parameters you set to decide. * @author peter. * */ public class CustomVideoView extends VideoView { private int mVideoWidth; private int mVideoHeight; public CustomVideoView(Context context) { super(context); } public CustomVideoView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomVideoView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { /* The following code is to make videoView view length-width based on the parameters you set to decide. */ int width = getDefaultSize(mVideoWidth, widthMeasureSpec); int height = getDefaultSize(mVideoHeight, heightMeasureSpec); setMeasuredDimension(width, height); } }
相关文章推荐
- 用CWnd类的函数MoveWindow()或SetWindowPos()可以改变控件的大小和位置
- 一个可以用鼠标改变控件位置和大小的类
- c# winform 一个可以用鼠标改变控件位置和大小的类,调用即可
- 用CWnd类的函数MoveWindow()或SetWindowPos()可以改变控件的大小和位置
- c# winform 一个可以用鼠标改变控件位置和大小的类,调用即可
- 一个可以自动改变控件位置和大小的对话框类
- c# winform 一个可以用鼠标改变控件位置和大小的类,调用即可
- C# Winform 一个可以用鼠标改变控件位置和大小的类,直接调用即可.....(代码收藏)
- 改变大小控件
- 对话框可以拖动改变大小
- 让对话框也可以通过拖放来改变大小
- 运行时改变控件大小运行时移动控件MINICAR版
- 控件随窗口大小的改变而改变
- 让VB自动改变控件大小
- .net,C#如何在运行时通过鼠标拖动改变控件的大小
- 实现控件的移动,改变大小(DELPHI实现)
- vb.net中运行时动态改变控件大小
- 控件的鼠标拖动和改变大小实现的思考
- MFC中改变控件的大小和位置(zz)
- 改变大小控件