簡體   English   中英

VIewPager2 使用 wrap_content 而不是 match_parent

[英]VIewPager2 using wrap_content instead of match_parent

我有一個水平滾動視圖尋呼機。 我將子項寬度設置為match_parent 但我讓他們wrap_content代替。 此視圖應以重力為中心,但父級的 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM