Image overlay

I'm trying to draw a medal superimposed on the corner of the grading screen shown here

There is a transparent layout with buttons and a RelativeLayout (black edge), which contains an inner box (gray box) that contains the rest of the data. I tried adding a medal to the upper left corner of the inside of the RelativeLayout and giving it negative margins, but that just cuts it off at the edge of the view. Adding it to a transparent layout puts it around the corner.

How can I get a medal to impose this corner? I would prefer to do this in xml if possible, but any suggestions are welcome.

+4
source share
3 answers

In the xml layout, the element that defines after overlay the element that defines earlier. So you can change the layout to something like this:

<LinearLayout> <LinearLayout> <!--grey box --> </LinearLayout> <ImageView src="medal" android:layout_marginLeft="-250dip"/> <!-- change the amount of marginLeft to your desire --> </LinearLayout> 
+2
source

You can also achieve this by setting the attributes android:clipChildren="false" and android:clipToPadding="false" in the parent view (and if this does not work, set it also in all groups of ancestor views, in the end it will work).

+4
source

All Articles