Android: RelativeLayout margin works but gets overridden
问题 Problem Using RelativeLayout.LayoutParams and marginTop before setLayoutParams( params ) . Works on all devices for half a second but some cases it bumps back to top. The view stays centered in the holding view on my Moto X 2014 running Lollipop but not on my Nexus 4 running Lollipop . Opening activity Opens activity The margin is fine and the SurfaceView is centered ~200ms delay The margin resets and its back to top (top of SurfaceView at the top of holder) Closing activity Back pressed