VideoView の上にボタンを表示または非表示にしようとすると問題が発生します。簡単にするために、このような xml ファイルを用意しました。実際のファイルにはもっと多くのボタンがあります。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<VideoView
android:id="@+id/videoEnter"
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:scaleType="fitXY" />
<Button
android:id="@+id/play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Play" />
</RelativeLayout>
基本的に、ビデオを再生するときはボタンを に設定しView.INVISIBLE
、ビデオが終了しonCompletion
たらボタンを に設定しますView.Visible
。問題は、ボタンをクリックできることですが、VideoView の背後にあり、表示されません。FrameLayoutでこれを機能させることができましたが、RelativeLayoutでしか機能しないように見える画面に合わせてビデオビューを引き伸ばす必要があります。このすべてを RelativeLayout で機能させる方法はありますか?
私も試してみ.bringToFront()
ましたが、成功しませんでした。
助けてくれてありがとう