How to create gradient overlay over Android Video Player and fade away

1.1k views Asked by At

I am interested in creating the following effect: a gradient (dark grey) overlay with icons over the Android Video Player on the phone. How could I achieve this? Also, how can I make this overlay/gradient fade away after a certain amount of idle time? Thank you.

enter image description here

1

There are 1 answers

1
Martin On BEST ANSWER

Sure. Here's the XML snippet for the overlay

.
.
.
    </RelativeLayout>
</ScrollView>

<View
    android:id="@+id/overlay"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/loading_overlay"
    android:visibility="gone" />
</LinearLayout>

I put the 'overlay' at the end of the entire layout so it is on top. I set it initially to "gone" so it doesn't show up. Then in my Java,

    overlay = (View) v.findViewById(R.id.overlay);
    overlay.setVisibility(View.GONE);

If your layout the view resides in, in my case a LinearLayout, has "animateLayoutChanges' set to true, then the default animation when I set the overlay to gone is to simply fade away. Very easy peasy