Ana Paula
Ana Paula

Reputation: 9497

Clickable floating action button outside of YouTubePlayerSupportFragment

I have an Activity with a YouTubePlayerSupportFragment and a floating action button. Before the video starts the floating button is clickable, but after the video initialization, I can't click anymore on the floating button. I would like to make it clickable after the video starts. I know that a View cannot be over a YouTubePlayer, but in this case, the button isn't overlaying the YouTubePlayer.

Here is my activity xml which contains both YouTubePlayerFragment and the floating button:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:id="@+id/activity_youtube_player_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="hanappaula.br.youtubedownloader.activities.YouTubePlayerActivity">

    <fragment
        android:id="@+id/activity_youtube_fragment"
        android:name="com.google.android.youtube.player.YouTubePlayerSupportFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

    <com.melnykov.fab.FloatingActionButton
        android:id="@+id/activity_youtube_floating_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:src="@drawable/ic_content_add"
        fab:fab_colorNormal="#2196F3"
        fab:fab_colorPressed="#448AFF"
        fab:fab_colorRipple="#9E9E9E" />

</RelativeLayout>

Upvotes: 0

Views: 885

Answers (1)

Ana Paula
Ana Paula

Reputation: 9497

I solved my problem. The thing was that I also had a PopupWindow with buttons to control de video (play, pause, fullscreen..) and it was overlaying the button. I set the heigh of the PopupWindow to coincide with the YouTubePlayerSupportFragment size.

Upvotes: 1

Related Questions