Cropping Android ViewGroup not working

Why android: clipChildren = "false" does not work? I want to achieve the same effect as CSS overflow: it seems that child views are displayed, even if they are located outside their parent layout. I tried something like this, and although the graphic layout in Eclipse shows the correct behavior, it doesn’t work on the phone.

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#0000FF" android:clipChildren="false" android:clipToPadding="false" > <RelativeLayout android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentLeft="true" android:background="#FF0000" android:clipChildren="false" android:clipToPadding="false" > <RelativeLayout android:layout_width="50dp" android:layout_height="50dp" android:layout_marginLeft="120dp" android:background="#00FF00" /> </RelativeLayout> </RelativeLayout> 
+4
source share
1 answer

I am trying something similar at the moment, and it only works when I use booth android:clipChildren="false" for all parents, the next problem is if there is something under the overlaid child word that is repainted Like ListView, Android forgot to recolor our child, and this fade: - (

Just a way to call .invalidate () manually on an overlay child after each redrawing of the view underneath it :-( I also found that at least a small world with an overlapping child should be in his parent's home.

And another problem is to receive touch / click events that are outside the parent. I did not find a solution for this.

+1
source

Source: https://habr.com/ru/post/1388497/


All Articles