TL Version; DR:
When I resize the parent:

Explanation:
in an Android application, I have a parent layout and inside it are several relative layouts.
<LinearLayout android:id="@+id/parent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" > <RelativeLayout android:id="@+id/child1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/transparent"> </RelativeLayout> <RelativeLayout android:id="@+id/child2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/transparent"> </RelativeLayout> </LinearLayout>
The children of this layout have several texts and pictures. I do the following:
When the user clicks on the button, I want to collapse the parent linear layout (animate the width to 0). I executed this function for this:
public static void collapseHorizontally(final View v) { final int initialWidth = v.getMeasuredWidth(); Animation a = new Animation() { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { if(interpolatedTime == 1){ v.setVisibility(View.GONE); }else{ v.getLayoutParams().width = initialWidth - (int)(initialWidth * interpolatedTime); v.requestLayout(); } } @Override public boolean willChangeBounds() { return true; } };
I call the above function in the parent view. This works correctly, and the parent view resizes in width until it reaches 0, after which I set its visibility to be gone.
My problem
While the parent view redraws (collapses), child views also change its size. I mean, when the width of the parent reaches one of the children, the child will also resize with it, and this will also lead to a resizing of the text views.
Here are some screenshots for an example:

Here you can see the original layout, there is a parent layout in green and a child’s layout (with date and text and icon).
Then, when I start reducing the size of the parent layout, the size of the layout of the child will also be affected, and it will reduce the size of the text image in it, causing the words to wrap, as shown in the following two images:


As you noticed, the text in the child case wraps as the width of the parent decreases.
Is there a way that the child does not change according to the parent view, but remains as it is, even if the size of the parent view is reduced? I need the chil element size to stay fixed during the resize animation, and then decrease by the parent instead of resizing.
Thanks so much for any help