The thing is, I want to show the picture above the video player. The video player is in the fragment, and the fragment is called in MainActivity , and in main_layout.xml is the FrameLayout itself in full screen for the player and above it ImageView . It does not work, that is, the player plays but the picture itself is not.

 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/container"> </FrameLayout> <ImageView android:layout_width="400dp" android:layout_height="200dp" app:srcCompat="@drawable/app_icon_your_company" android:id="@+id/imageView" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentBottom="true" android:layout_marginLeft="20dp" android:layout_marginStart="20dp" android:layout_marginBottom="20dp"/> </RelativeLayout> 

I tried to use the Fragment component instead of calling the Fragment in MainActivty and register the fragment class in xml, the player works again without a picture. I even tried to insert a picture into the markup of the player itself, anyway, it does not see it.

Question: what am I doing wrong?

I use the JieCaoVideoPlayer library

  • Can try the standard way of putting a picture instead of app:srcCompat ? - Yuriy SPb
  • @Yuriy SPb, thanks helped !!! - DevOma
  • Wrote in response) - YuriySPb

2 answers 2

In this case, the error is that you are using the wrong attribute to specify which picture to display. Replace

app: srcCompat

on

 android:src 
  • But I wonder what the differences are? - DevOma
  • @TITAN, if I'm not mistaken, then your method is a legacy of an attempt to display vector images in one of the already old versions of support. After displaying the vectors, the settings were fine and this attribute is no longer needed - YuriySPb

In RelativeLayout, views are always on the same level. Try to make ImageView higher in the hierarchy than FrameLayout, for example, to attach to LinearLayout

those

 <RelativeLayout> ... <FrameLayout> </FrameLayout> <LinearLayout> <ImageView> </ImageView> </LinearLayout> ... </RelativeLayout>