[英]VIewPager2 using wrap_content instead of match_parent
I have a horizontal scrolling view pager.我有一个水平滚动视图寻呼机。 I set child items width to match_parent
.我将子项宽度设置为match_parent
。 But im getting them wrap_content
instead.但我让他们wrap_content
代替。 This view should be centred by gravity but parent's FrameLayout is cropped to child's width Items code:此视图应以重力为中心,但父级的 FrameLayout 被裁剪为子级的宽度 Items 代码:
<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>
我认为问题可能与您正在播放的视频的分辨率有关,而不是与其父宽度匹配的视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.