Getting the undivided part of the slider / linearlayout so as not to resize

I have a basic slider with two linear layouts. (Here is the relevant layout information:

<RelativeLayout> <LinearLayout id:"left" android:layout_alignParentLeft="true"> ... </LinearLayout> <LinearLayout id:"right" android:layout_alignParentRight="true"> <ImageView id:"first"></ImageView> <ImageView id:"second"></ImageView> </LinearLayout> </RelativeLayout> 

both left and right have child views. By default, is displayed on the left. When the user slides left, right becomes visible. Children right are two kinds of images: first and second .

My problem is that when the user slides left, I need second to become visible. Then, when the user glides further, I need to first become visible.

Right now, it’s rather a pulling effect. What I want is the manifestation / effect of the peeling: when I tear off the left to show that the second image was all the time; then when I pull a little more to show that the first image was also always there all the time.

Anyone with GMail on their iPhone can see the peeling effect.

Another problem with my design is that when I extend left , first grows from a point to a full image; as I pull still, right does the same. Images should not grow (in radius) from a point. Despite the lack of a screen, they must be full-sized so that they look as if growing from a slab into a rectangle; how in

  | || ||| 

when I pull to the left.

+4
source share
1 answer

so I solved the problem by adding LinearLayout android:scaleType="fitXY" and setting a fixed width for both ImageViews. I hope the next person finds this helpful.

PS I saw that GMail did it on the iPhone, but not on Android. Well, GMail, now you know how to do it. :)

+2
source

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


All Articles