私は私の全体のビデオの背景を持っていたい画面。すべてが正しくJavaで動作します:ループなど。問題はxmlにある可能性があります。 現在、私は画面上部にビデオを持っていますが、これは次のように見えます。(ビデオは端に完全にフィットしています)
私の目標を達成するために私のxmlの外観をどうすればいいのですか。ありがとう。
XML:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<VideoView
android:id="@+id/surface"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</FrameLayout>
回答:
回答№1は1まず目的が横長モードであると言ったので、向きを横に設定する必要があります
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // add it below super.oncreate
このコードが動作しない場合は、これをチェックしてください リンク
またはあなたはマニフェストのオリエンテーションをGoogleに設定することができます
これをあなたのxmlで変更してください
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<VideoView
android:id="@+id/surface"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
/>
</FrameLayout>