android - VIewPager2 使用 wrap_content 而不是 match_parent
问题描述
我有一个水平滚动视图寻呼机。我将子项宽度设置为match_parent
. 但我得到了他们wrap_content
。此视图应以重力为中心,但父级的 FrameLayout 被裁剪为子级的宽度项目代码:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/exo_player"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:use_controller="false" />
<ImageView
android:id="@+id/sound"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="bottom|right"
android:layout_margin="13dp"
android:src="@drawable/icon_sound_off_active" />
</FrameLayout>
解决方案
我认为这个问题可能与您正在播放的视频的分辨率有关,而不是与其父级宽度匹配的视图。
推荐阅读
- sql - 选择交付的最高订单
- reactjs - 从对象数组访问数据时反应中的类型错误
- c# - 重定向页面后会话丢失
- python - 如何将 AxesSubplot 转换为 Axes 对象以使 subplots_adjust 仅适用于未转换的 AxesSubplot
- python - 使用条件操作一列数据框
- java - PDFBox:COSStream 已关闭,无法读取。将 PDF 文件添加到 PDF。并回顾
- linux - Linux执行带参数的php文件
- javascript - 当我尝试单击按钮时出现未捕获的 DOMException 问题
- javascript - 如何在尝试使用 innerHTML 时修复按钮禁用问题?
- c++ - 如何在 vs code c++ 中添加静态库?