19

ビデオビューを埋めるためにビデオを引き延ばそうとします。ターゲットは、デバイスで最初の写真のように見えるビューを作成することです (レイアウト プレビューで見えるように)。

この質問に対する回答のほとんどは、このリンクを参照しています。

これを試しましたが、まだビデオビューを埋めていません。

これは私のレイアウトコードです:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" 
    android:background="@drawable/search_gren_screen">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/go_back"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:onClick="onclick"
            android:text="Try again" />

        <Button
            android:id="@+id/back_to_pick_song"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:text="Select another song" 
            android:onClick="onclick" />

        <Button
            android:id="@+id/btn_continue"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:onClick="onclick"
            android:text="Amazing, continue!" />
    </LinearLayout>

    <FrameLayout 
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">
    <VideoView 
        android:id="@+id/videoView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:layout_gravity="center" />
    </FrameLayout>
</LinearLayout>

ここに、宣言されたレイアウトのプレビューがあります。

ここに画像の説明を入力

ただし、デバイスでの結果は異なります。

ここに画像の説明を入力

4

3 に答える 3

0

このfill_parent方法は私にはうまくいきません。

最後に、私はこのライブラリを使用しています。

https://github.com/dmytrodanylyk/video-crop

于 2020-08-17T17:43:48.240 に答える