Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide view behind another view in Android

I'm trying to get a view to "slide behind" another view. Consider a set of cards as an example: if I put card A behind card B, card A is still there but it is being blocked because card B is OVER or IN-FRONT-OF card A.

I am well aware of setInvisibilty() but that is not the effect I'm looking for.

I have an animation that animates a Google-Now-card-like view onto the screen. The card passes over some text that is shown in front of the card (whereas I want the card to slide above the text) during the animation. I have an alpha animation on the text which does not help as it's already pretty solid by the time the card passes over.

Any response to the problem above or suggestions for a different method are highly appreciated.

like image 686
sjbhalli Avatar asked Dec 23 '14 15:12

sjbhalli


People also ask

How do I hide a view?

Use with setVisibility(int) and android:visibility . This view is invisible, and it doesn't take any space for layout purposes.

How do you animate a view?

Create ImageView in the activity_main. xml along with buttons that will add animation to the view. Navigate to the app > res > layout > activity_main. xml.

What is Android view view?

View is a basic building block of UI (User Interface) in android. A view is a small rectangular box that responds to user inputs. Eg: EditText, Button, CheckBox, etc. ViewGroup is an invisible container of other views (child views) and other ViewGroup.


1 Answers

See this previous question : Defining Z order of views of RelativeLayout in Android

View.bringToFront()

Is what you're looking for.

like image 166
Rogue Avatar answered Oct 26 '22 14:10

Rogue