I have had no problems with this, though I have been using View.GONE. Here is an (old) sample app that worked the last time I tried it:
https://github.com/commonsguy/vidtry There are top and bottom panels that appear and disappear based on touch events, with a SurfaceView underneath for playing back a streaming video. On Fri, Oct 21, 2011 at 3:38 PM, Christopher Van Kirk <[email protected]> wrote: > So, I'm trying to control the visibility of a view in my app with > setVisibility, but it's not working. > > Here's what I do. > > The layout doesn't specify visibility, so it gets the default visibility of > "VISIBLE". The layout looks like this: > > FrameLayout { > SurfaceView // background > LinearLayout { > View // button > View // button > View // button > } > } > > In code, just after I setContentView( myframe ) in my Activity's > constructor, I get the views for the three buttons and setVisibility( > View.INVISIBLE ) on them. > > So far, this part works. If I don't setVisibility( View.INVISIBLE ) I can > see the three views right where they are supposed to be, and when I > setVisibility( View.INVISIBLE ) I can't see them. So far so good. > > Ok, so I do some work and now I want to see those buttons again. So I go in > and setVisibility( View.VISIBLE ) on them. > > They don't show up. > > I've tried calling invalidate() on the views, bringToFront(). Seems like > once they are hidden I can't bring them back. > > Anyone have any ideas why this wouldn't be working? > > I should note that the background view is a GLSurfaceView, but I don't think > that should cause any problems, should it? > > Cheers, > > Chris... > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _Android Programming Tutorials_ Version 4.0 Available! -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

