How can I make surface visibility invisible in Android?

In my application, I use a media player with a search bar. The search string works with a view of the surface. Now my problem is that the surface view appears in the corner of my layout, which looks like a black screen. How can I make the surface view invisible. Below is an image of my layout,

enter image description here

+3
source share
2 answers

You can do this by setting the visibility in the code:

surfaceView.setVisibility(View.GONE)or surfaceView.setVisibility(View.INVISIBLE).

And you can do the same by setting it to XML:

<SurfaceView 
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:visibility="gone"/>

GONE is used if you want it to completely disappear and be ignored by the rest of the layout. INVISIBLE is used if you want to change the visibility.

+5
source

surfaceView.setVisibility * (View.INVISIBLE);

-1

All Articles