Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method to allow a single child view to overflow the viewgroup bounds?

The following screenshot illustrates a simple example of what I have now:

enter image description here

What I'd like to achieve, is that the selected (blue) view not be clipped at the boundary of the red container. My first try was clipChildren="false", which causes the blue view to expand outside of its borders, filling the the red area. I just want to see the portion overlaying the green area.

like image 218
Mark Renouf Avatar asked Nov 13 '22 14:11

Mark Renouf


1 Answers

I think you'll have to float the blue on top of both the red and green. You can't have a child outside of its parent ViewGroup (AFAIK). You'll need to redesign your layout.

Getting what you want should be pretty easy, though. I don't use the graphical designer, so would need XML.

FrameLayout with LinearLayout inside to show the Red/Green, then another Linear or Relative after the first LinearyLayout (inside the FrameLayout). With LinearLayout, I'd align right, and give the blue element some padding.

It may be possible to do this all with RelativeLayout, but I tend to stay away from it.

like image 162
Kevin Galligan Avatar answered May 12 '23 17:05

Kevin Galligan