Created
June 22, 2015 04:23
-
-
Save r17171709/bb0e3e5f005d2ace08b4 to your computer and use it in GitHub Desktop.
视频横竖屏切换
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 切换为全屏 | |
private void setFullScreen() { | |
if (Build.VERSION.SDK_INT >= 9) { | |
setRequestedOrientation(6); | |
} else { | |
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); | |
} | |
getWindow().addFlags(1024); | |
mActionBar.hide(); | |
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( | |
getWindowManager().getDefaultDisplay().getWidth(), | |
getWindowManager().getDefaultDisplay().getHeight()); | |
mVV.setLayoutParams(layoutParams); | |
mController.setLayoutParams(layoutParams); | |
VideoAction.setLayoutParams(layoutParams); | |
zoom_btn.setBackgroundResource(R.drawable.screensize_zoomin_button); | |
rl_container.setFocusable(true); | |
rl_container.setFocusableInTouchMode(true); | |
rl_container.requestFocus(); | |
isFullScreen = true; | |
} | |
// 切换为小屏幕 | |
private void setMinScreen() { | |
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | |
getWindow().clearFlags(1024); | |
mActionBar.show(); | |
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( | |
getWindowManager().getDefaultDisplay().getWidth(), | |
getDimen(R.dimen.video_play_heigh)); | |
mVV.setLayoutParams(layoutParams); | |
mController.setLayoutParams(layoutParams); | |
VideoAction.setLayoutParams(layoutParams); | |
zoom_btn.setBackgroundResource(R.drawable.screensize_zoomout_button); | |
isFullScreen = false; | |
} | |
<RelativeLayout | |
android:id="@+id/rl_container" | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content" > | |
<com.baidu.cyberplayer.core.BVideoView | |
android:id="@+id/video_view" | |
android:layout_width="fill_parent" | |
android:layout_height="@dimen/video_play_heigh" | |
android:background="@android:color/black" /> | |
</RelativeLayout> | |
//https://github.com/panjichang/small_video |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment