diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java
index fc41031756..86fe7a3f7f 100644
--- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java
+++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java
@@ -83,6 +83,12 @@ import java.util.List;
*
Default: {@code true}
*
*
+ * {@code shutter_background_color} - The background color of the {@code exo_shutter} view.
+ *
+ * - Corresponding method: {@link #setShutterBackgroundColor(int)}
+ * - Default: {@code 0}
+ *
+ *
* {@code hide_on_touch} - Whether the playback controls are hidden by touch events.
*
* - Corresponding method: {@link #setControllerHideOnTouch(boolean)}
@@ -249,6 +255,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
return;
}
+ int shutterColor = 0;
int playerLayoutId = R.layout.exo_simple_player_view;
boolean useArtwork = true;
int defaultArtworkId = 0;
@@ -262,6 +269,7 @@ public final class SimpleExoPlayerView extends FrameLayout {
TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
R.styleable.SimpleExoPlayerView, 0, 0);
try {
+ shutterColor = a.getColor(R.styleable.SimpleExoPlayerView_shutter_background_color, shutterColor);
playerLayoutId = a.getResourceId(R.styleable.SimpleExoPlayerView_player_layout_id,
playerLayoutId);
useArtwork = a.getBoolean(R.styleable.SimpleExoPlayerView_use_artwork, useArtwork);
@@ -293,6 +301,9 @@ public final class SimpleExoPlayerView extends FrameLayout {
// Shutter view.
shutterView = findViewById(R.id.exo_shutter);
+ if (shutterView != null) {
+ shutterView.setBackgroundColor(shutterColor);
+ }
// Create a surface view and insert it into the content frame, if there is one.
if (contentFrame != null && surfaceType != SURFACE_TYPE_NONE) {
@@ -513,6 +524,17 @@ public final class SimpleExoPlayerView extends FrameLayout {
}
}
+ /**
+ * Sets the background color of the {@code exo_shutter} view.
+ *
+ * @param color A resolved color (not a resource ID) for the background of the shutter view.
+ */
+ public void setShutterBackgroundColor(int color) {
+ if (shutterView != null) {
+ shutterView.setBackgroundColor(color);
+ }
+ }
+
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (player != null && player.isPlayingAd()) {
diff --git a/library/ui/src/main/res/values/attrs.xml b/library/ui/src/main/res/values/attrs.xml
index d02d54ef23..eb9edaccdc 100644
--- a/library/ui/src/main/res/values/attrs.xml
+++ b/library/ui/src/main/res/values/attrs.xml
@@ -43,6 +43,7 @@
+