FillParentVideoView
Let VideoView fill the screen/parent layout and ensure no distortion
Install / Use
/learn @bookzhan/FillParentVideoViewREADME
Let VideoView fill the screen/parent layout and ensure no distortion
It is a good choice to simply play video in Android with VideoView. Various manufacturers generally test video playback at the factory. This compatibility is generally guaranteed, and using VideoView playback will automatically correct the video angle, but there are One problem is that VideoView always has some blank areas left during use. Many times we want him to fill the screen, or the parent layout, so we have today’s topic (of course, you can also use OpenGL to draw the video).
First of all, there is a pit when VideoView is used, that is, the video address must be given to it during initialization, otherwise the video is distorted, because the size information of the video is not obtained during the layout, so it is not known during initialization How much Surface to initialize, this determines two ways to use VideoView:
- When placed in xml, then you need to pass in the video address during Activity onCreate.
- The dynamic new VideoView() is then added to the specified parent control, and the video address also needs to be passed in
The principle is as follows:
- Get the accurate video width and height after getting the video address
- In onSizeChanged, calculate the layout parameters of VideoView according to the width and height of the video and the width and height of the parent layout, and use the -margin to display the extra area of the video to the outside of the control, so as to fill the parent control
- Rewrite the onMeasure method to override the logic of VideoView, and then enjoy it
Related Skills
qqbot-channel
351.2kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.5k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
351.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
Design
Campus Second-Hand Trading Platform \- General Design Document (v5.0 \- React Architecture \- Complete Final Version)1\. System Overall Design 1.1. Project Overview This project aims t
