androidandroid-layoutandroid-videoviewtextureviewandroid-textureview

How add view over TextureView


i need to add View over my TextureView which play video in it i used VideoView before and it was totally fine but i had problem with animation so i changed it to TextureView and now i can't put any View over it! seems that Textureview will cover over all views this is my xml layout :

  <FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/frmview"
    >

    <com.my.app.TextureVideoView
        android:id="@+id/vv_play"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:alpha="0.0" />

    <ImageView
        android:id="@+id/iv_play"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:srcCompat="@drawable/app_ic" />
</FrameLayout>

How can i put a View over TextureView which is playing video?


Solution

  • finally i had to add it programmically to my FrameLayout after initializing TextureView and playing video!

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
    
        mPreview = (TextureView) findViewById(R.id.vv_play);
        mPreview.setSurfaceTextureListener(this);
        FrameLayout frameLayout = (FrameLayout) findViewById(R.id.frmview);
    
        ImageView img = new ImageView(this);
        img.setImageResource(R.drawable.app_ic);
        frameLayout.addView(img);
    }