File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,17 @@ protected void onWindowVisibilityChanged(int visibility) {
230230 public void setVisibility (int visibility ) {
231231 super .setVisibility (visibility );
232232 mViewVisibility = visibility == VISIBLE ;
233- mRequestedVisible = mWindowVisibility && mViewVisibility ;
233+ boolean newRequestedVisible = mWindowVisibility && mViewVisibility ;
234+ if (newRequestedVisible != mRequestedVisible ) {
235+ // our base class (View) invalidates the layout only when
236+ // we go from/to the GONE state. However, SurfaceView needs
237+ // to request a re-layout when the visibility changes at all.
238+ // This is needed because the transparent region is computed
239+ // as part of the layout phase, and it changes (obviously) when
240+ // the visibility changes.
241+ requestLayout ();
242+ }
243+ mRequestedVisible = newRequestedVisible ;
234244 updateWindow (false , false );
235245 }
236246
You can’t perform that action at this time.
0 commit comments