【问题标题】:VIewPager2 using wrap_content instead of match_parentVIewPager2 使用 wrap_content 而不是 match_parent
【发布时间】:2020-03-30 15:46:59
【问题描述】:

我有一个水平滚动视图寻呼机。我将子项宽度设置为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>

【问题讨论】:

    标签: android android-layout android-viewpager2


    【解决方案1】:

    我认为问题可能与您正在播放的视频的分辨率有关,而不是与其父级宽度匹配的视图。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-02
      • 2017-11-27
      • 1970-01-01
      • 2017-02-17
      • 1970-01-01
      • 2023-04-02
      • 2020-02-08
      • 1970-01-01
      相关资源
      最近更新 更多