当时是这么写的,其中的vv是那个VideoView。注意不一定好,仅供参考,误导莫怪:
public void setVideoViewFullScreen(){
/**
* 设置全屏必须在横屏和竖屏时都管用,也即要跟横屏和竖屏无关
* 视频尽可能充满屏幕,不能填满的地方黑屏
* 不能改变长宽比
*/
android.support.v4.view.ViewPager pager = (android.support.v4.view.ViewPager)findViewById(R.id.pager);
LinearLayout bottom = (LinearLayout)findViewById(R.id.bottom);
pager.setVisibility(View.GONE);
bottom.setVisibility(View.GONE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
actionBar.hide();
mainWindow.setBackgroundColor(Color.BLACK);
android.widget.LinearLayout.LayoutParams params = (android.widget.LinearLayout.LayoutParams) vv.getLayoutParams();
partScreenHeight = params.height;
partScreenWidth = params.width;
Log.d(LocalConst.DTAG, "screen: backup params " + partScreenHeight + " " + partScreenWidth);
params.height = android.widget.LinearLayout.LayoutParams.MATCH_PARENT;
params.width = android.widget.LinearLayout.LayoutParams.MATCH_PARENT;
vv.setLayoutParams(params);
}