5

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.

Mark Renouf
  • 30,697
  • 19
  • 94
  • 123

2 Answers2

1

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.

Kevin Galligan
  • 16,159
  • 5
  • 42
  • 62
  • This is what I ended up doing, It's part of an animation so it was a bit tricky but I temporarily move the view to a FrameLayout the same size as the screen, then move it back. – Mark Renouf Nov 12 '11 at 12:32
0

Essentially what you're looking for is overlapping views. This can be done with a FrameLayout. For information on how to do this, please checkout this example.

Mark Cramer
  • 2,614
  • 5
  • 33
  • 57
Kurtis Nusbaum
  • 30,445
  • 13
  • 78
  • 102