Android ImageView是否在VideoView上可见?
我希望能够在imageview中设置可见图像(Android ImageView是否在VideoView上可见?,android,imageview,android-imageview,android-videoview,Android,Imageview,Android Imageview,Android Videoview,我希望能够在imageview中设置可见图像( 在videoview中播放视频时占据半个屏幕)。有可能做到这一点吗?创建这样的xml 为视图添加相等的权重,并使其高度为0dp,它将采用相同的高度 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match
在videoview中播放视频时占据半个屏幕)。有可能做到这一点吗?创建这样的xml 为视图添加相等的权重,并使其高度为0dp,它将采用相同的高度
<?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"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#ccc"
/>
<VideoView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>
这将对您有所帮助。谢谢您,我正试图在这样的相对布局中这样做,但当我更改图像可见性时,视频已覆盖图像。。。我想要的是相反的,视频上的图像
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PatternSelection" >
<ImageView
android:id="@+id/settse"
android:layout_width="480dp"
android:layout_height="270dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:visibility="invisible"
app:srcCompat="@drawable/sett" />
<VideoView
android:id="@+id/videoView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
是的,这是可能的。谢谢你,我正试图在这样的相对布局中这样做,但当我更改图像可见性时,视频覆盖在图像上。。。我想要的是相反的,所以视频上的图像。答案是更新的,请看一看,让我知道,这是否是你试图实现的事情。