What should I do to partially hide some layout from code? Should I play with setMargins?
Basically, I want to detect size of the screen and then I want that element X becomes visible only 10% of its width? I know how to do it all except how to make it partially hidden or offscreen?
Look at these images to see what I want to achieve. Image 1 – UI element is in the center. Image 2 – I set in code it’s moved to top offscreen thus becoming only partially visible.


I found out that here as well the best solution is to use
Animation(TranslateAnimation) by setting this on the first screen load and setting its speed to minimum value of 1 millisecond. The transition in reality is unnoticeable to a human eye.Also do not use margins as they simply “push” element from one side without making it goes offset. If you have any child in the layout you want to offset, they all will be squeezed as you increase margin values.
NOTE: if you ever want to use animation on that screen on the element you offset before, take into account the negative value of offset. Otherwise your animation will not look nice. To avoid bumping effect, take special care of
fromXDeltavalue.