How to animate height change of views inside a LinearLayout?












0















I am working on an Android 4+ app which uses a quite simply layout: Multiple views are stacked using a LinearLayout within a ScrollView



<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="HardcodedText,UseCompoundDrawables,UselessParent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"

<!-- Top Container -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"

<Button... />
</LinearLayout>

<!-- Hidden Container -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"

... Some Content ...

</LinearLayout>

<!-- Bottom Container -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"

... Some Content ...

</LinearLayout>
</LinearLayout>
</ScrollView>


The HiddenContainer should not be visible when the layout it created. Thus in the beginning the BottomContainer is directly beneath the TopContainer. A click on the Button within the TopContainer toggles the visibility of the HiddenContainer.



Doing this with hiddenContainer.setVisibility(hiddenContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE) works find and without any problem. However it does not look good when the view suddenly appears or disappears. Instead I would like to animate the change.



I was surprised that I was not able to find an easy solution for this:




  • Using android:animateLayoutChanges="true" does work, however I am not able to control the animation.

  • While using a ValueAnimator to change hiddenContainer.setScaleY(...) gives me control over the animation setScaleY(0) makes the container invisible without reducing the space it occupies within the layout.

  • Using the ValueAnimator to change hiddenContainer.setHeight(...) might work, however I don't want to use a fixed height value when showing the container (e.g. hiddenContainer.setHeight(300)) but the height which is determined by the containers content.


So, how to solve this?










share|improve this question



























    0















    I am working on an Android 4+ app which uses a quite simply layout: Multiple views are stacked using a LinearLayout within a ScrollView



    <ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="HardcodedText,UseCompoundDrawables,UselessParent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusableInTouchMode="true">

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"

    <!-- Top Container -->
    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"

    <Button... />
    </LinearLayout>

    <!-- Hidden Container -->
    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"

    ... Some Content ...

    </LinearLayout>

    <!-- Bottom Container -->
    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"

    ... Some Content ...

    </LinearLayout>
    </LinearLayout>
    </ScrollView>


    The HiddenContainer should not be visible when the layout it created. Thus in the beginning the BottomContainer is directly beneath the TopContainer. A click on the Button within the TopContainer toggles the visibility of the HiddenContainer.



    Doing this with hiddenContainer.setVisibility(hiddenContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE) works find and without any problem. However it does not look good when the view suddenly appears or disappears. Instead I would like to animate the change.



    I was surprised that I was not able to find an easy solution for this:




    • Using android:animateLayoutChanges="true" does work, however I am not able to control the animation.

    • While using a ValueAnimator to change hiddenContainer.setScaleY(...) gives me control over the animation setScaleY(0) makes the container invisible without reducing the space it occupies within the layout.

    • Using the ValueAnimator to change hiddenContainer.setHeight(...) might work, however I don't want to use a fixed height value when showing the container (e.g. hiddenContainer.setHeight(300)) but the height which is determined by the containers content.


    So, how to solve this?










    share|improve this question

























      0












      0








      0








      I am working on an Android 4+ app which uses a quite simply layout: Multiple views are stacked using a LinearLayout within a ScrollView



      <ScrollView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      tools:ignore="HardcodedText,UseCompoundDrawables,UselessParent"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:focusableInTouchMode="true">

      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"

      <!-- Top Container -->
      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"

      <Button... />
      </LinearLayout>

      <!-- Hidden Container -->
      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"

      ... Some Content ...

      </LinearLayout>

      <!-- Bottom Container -->
      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"

      ... Some Content ...

      </LinearLayout>
      </LinearLayout>
      </ScrollView>


      The HiddenContainer should not be visible when the layout it created. Thus in the beginning the BottomContainer is directly beneath the TopContainer. A click on the Button within the TopContainer toggles the visibility of the HiddenContainer.



      Doing this with hiddenContainer.setVisibility(hiddenContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE) works find and without any problem. However it does not look good when the view suddenly appears or disappears. Instead I would like to animate the change.



      I was surprised that I was not able to find an easy solution for this:




      • Using android:animateLayoutChanges="true" does work, however I am not able to control the animation.

      • While using a ValueAnimator to change hiddenContainer.setScaleY(...) gives me control over the animation setScaleY(0) makes the container invisible without reducing the space it occupies within the layout.

      • Using the ValueAnimator to change hiddenContainer.setHeight(...) might work, however I don't want to use a fixed height value when showing the container (e.g. hiddenContainer.setHeight(300)) but the height which is determined by the containers content.


      So, how to solve this?










      share|improve this question














      I am working on an Android 4+ app which uses a quite simply layout: Multiple views are stacked using a LinearLayout within a ScrollView



      <ScrollView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      tools:ignore="HardcodedText,UseCompoundDrawables,UselessParent"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:focusableInTouchMode="true">

      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"

      <!-- Top Container -->
      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"

      <Button... />
      </LinearLayout>

      <!-- Hidden Container -->
      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"

      ... Some Content ...

      </LinearLayout>

      <!-- Bottom Container -->
      <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"

      ... Some Content ...

      </LinearLayout>
      </LinearLayout>
      </ScrollView>


      The HiddenContainer should not be visible when the layout it created. Thus in the beginning the BottomContainer is directly beneath the TopContainer. A click on the Button within the TopContainer toggles the visibility of the HiddenContainer.



      Doing this with hiddenContainer.setVisibility(hiddenContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE) works find and without any problem. However it does not look good when the view suddenly appears or disappears. Instead I would like to animate the change.



      I was surprised that I was not able to find an easy solution for this:




      • Using android:animateLayoutChanges="true" does work, however I am not able to control the animation.

      • While using a ValueAnimator to change hiddenContainer.setScaleY(...) gives me control over the animation setScaleY(0) makes the container invisible without reducing the space it occupies within the layout.

      • Using the ValueAnimator to change hiddenContainer.setHeight(...) might work, however I don't want to use a fixed height value when showing the container (e.g. hiddenContainer.setHeight(300)) but the height which is determined by the containers content.


      So, how to solve this?







      android animation android-animation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 14:14









      Andrei HerfordAndrei Herford

      5,8181048108




      5,8181048108
























          1 Answer
          1






          active

          oldest

          votes


















          0














          For animate your changes of layout (alpha, visibility, height, etc) you can use TransitionManager. For example: I have three static methods and use them when I want to animate layout changes:



          public static final int DURATION = 200;

          public static void beginAuto(ViewGroup viewGroup) {
          AutoTransition transition = new AutoTransition();
          transition.setDuration(DURATION);
          transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginFade(ViewGroup viewGroup) {
          Fade transition = new Fade();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginChangeBounds(ViewGroup viewGroup) {
          ChangeBounds transition = new ChangeBounds();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }


          And when you want to animate layout changes you can just call one of this methods before layout changings:



          beginAuto(hiddenContainerParentLayout);
          hiddenContainer.setVisibility(hiddenContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE)





          share|improve this answer
























          • Thanks, this works pretty well. However when hiding the view the scroll "collapses" immediately and not animated. Assume that the ScrollView currently shows the ToggleButton and the complete HiddenContainer. So the ToggleButton would be at the top of the screen. When hiding the HiddenContainer the buttom "jumps" to the bottom of the screen (since the scroll content does not fill the entire screen any more) and on can see how the bottom view animates towards the top view. So while the animation works fine, the size change of the scroll content happens immediately.

            – Andrei Herford
            Nov 14 '18 at 8:44











          • In this case you should call beginAuto for root layout of ScrollView, with this solusition when you change visibility of HiddenContainer animator also animate changing coordinates of BottomContainer in ScrollView

            – Onix
            Nov 14 '18 at 9:00











          • As shown in my post ScrollView is the root layout. Even when I add another layout to wrap ScrollView and apply beginAuto to this one, the result is absolutely the same.

            – Andrei Herford
            Nov 14 '18 at 9:23











          • You can try using beginChangeBounds instead of beginAuto, or call beginAuto for parent of ScrollView (or for root layout). I hope one of this solutions help you.

            – Onix
            Nov 14 '18 at 9:30











          • The transition type (auto, fade, changeBound, etc.) does not make any difference. As explained ScrollView IS the root layout (has no parent) and adding a parent also makes no difference.

            – Andrei Herford
            Nov 14 '18 at 9:39











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53282965%2fhow-to-animate-height-change-of-views-inside-a-linearlayout%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          For animate your changes of layout (alpha, visibility, height, etc) you can use TransitionManager. For example: I have three static methods and use them when I want to animate layout changes:



          public static final int DURATION = 200;

          public static void beginAuto(ViewGroup viewGroup) {
          AutoTransition transition = new AutoTransition();
          transition.setDuration(DURATION);
          transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginFade(ViewGroup viewGroup) {
          Fade transition = new Fade();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginChangeBounds(ViewGroup viewGroup) {
          ChangeBounds transition = new ChangeBounds();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }


          And when you want to animate layout changes you can just call one of this methods before layout changings:



          beginAuto(hiddenContainerParentLayout);
          hiddenContainer.setVisibility(hiddenContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE)





          share|improve this answer
























          • Thanks, this works pretty well. However when hiding the view the scroll "collapses" immediately and not animated. Assume that the ScrollView currently shows the ToggleButton and the complete HiddenContainer. So the ToggleButton would be at the top of the screen. When hiding the HiddenContainer the buttom "jumps" to the bottom of the screen (since the scroll content does not fill the entire screen any more) and on can see how the bottom view animates towards the top view. So while the animation works fine, the size change of the scroll content happens immediately.

            – Andrei Herford
            Nov 14 '18 at 8:44











          • In this case you should call beginAuto for root layout of ScrollView, with this solusition when you change visibility of HiddenContainer animator also animate changing coordinates of BottomContainer in ScrollView

            – Onix
            Nov 14 '18 at 9:00











          • As shown in my post ScrollView is the root layout. Even when I add another layout to wrap ScrollView and apply beginAuto to this one, the result is absolutely the same.

            – Andrei Herford
            Nov 14 '18 at 9:23











          • You can try using beginChangeBounds instead of beginAuto, or call beginAuto for parent of ScrollView (or for root layout). I hope one of this solutions help you.

            – Onix
            Nov 14 '18 at 9:30











          • The transition type (auto, fade, changeBound, etc.) does not make any difference. As explained ScrollView IS the root layout (has no parent) and adding a parent also makes no difference.

            – Andrei Herford
            Nov 14 '18 at 9:39
















          0














          For animate your changes of layout (alpha, visibility, height, etc) you can use TransitionManager. For example: I have three static methods and use them when I want to animate layout changes:



          public static final int DURATION = 200;

          public static void beginAuto(ViewGroup viewGroup) {
          AutoTransition transition = new AutoTransition();
          transition.setDuration(DURATION);
          transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginFade(ViewGroup viewGroup) {
          Fade transition = new Fade();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginChangeBounds(ViewGroup viewGroup) {
          ChangeBounds transition = new ChangeBounds();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }


          And when you want to animate layout changes you can just call one of this methods before layout changings:



          beginAuto(hiddenContainerParentLayout);
          hiddenContainer.setVisibility(hiddenContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE)





          share|improve this answer
























          • Thanks, this works pretty well. However when hiding the view the scroll "collapses" immediately and not animated. Assume that the ScrollView currently shows the ToggleButton and the complete HiddenContainer. So the ToggleButton would be at the top of the screen. When hiding the HiddenContainer the buttom "jumps" to the bottom of the screen (since the scroll content does not fill the entire screen any more) and on can see how the bottom view animates towards the top view. So while the animation works fine, the size change of the scroll content happens immediately.

            – Andrei Herford
            Nov 14 '18 at 8:44











          • In this case you should call beginAuto for root layout of ScrollView, with this solusition when you change visibility of HiddenContainer animator also animate changing coordinates of BottomContainer in ScrollView

            – Onix
            Nov 14 '18 at 9:00











          • As shown in my post ScrollView is the root layout. Even when I add another layout to wrap ScrollView and apply beginAuto to this one, the result is absolutely the same.

            – Andrei Herford
            Nov 14 '18 at 9:23











          • You can try using beginChangeBounds instead of beginAuto, or call beginAuto for parent of ScrollView (or for root layout). I hope one of this solutions help you.

            – Onix
            Nov 14 '18 at 9:30











          • The transition type (auto, fade, changeBound, etc.) does not make any difference. As explained ScrollView IS the root layout (has no parent) and adding a parent also makes no difference.

            – Andrei Herford
            Nov 14 '18 at 9:39














          0












          0








          0







          For animate your changes of layout (alpha, visibility, height, etc) you can use TransitionManager. For example: I have three static methods and use them when I want to animate layout changes:



          public static final int DURATION = 200;

          public static void beginAuto(ViewGroup viewGroup) {
          AutoTransition transition = new AutoTransition();
          transition.setDuration(DURATION);
          transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginFade(ViewGroup viewGroup) {
          Fade transition = new Fade();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginChangeBounds(ViewGroup viewGroup) {
          ChangeBounds transition = new ChangeBounds();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }


          And when you want to animate layout changes you can just call one of this methods before layout changings:



          beginAuto(hiddenContainerParentLayout);
          hiddenContainer.setVisibility(hiddenContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE)





          share|improve this answer













          For animate your changes of layout (alpha, visibility, height, etc) you can use TransitionManager. For example: I have three static methods and use them when I want to animate layout changes:



          public static final int DURATION = 200;

          public static void beginAuto(ViewGroup viewGroup) {
          AutoTransition transition = new AutoTransition();
          transition.setDuration(DURATION);
          transition.setOrdering(TransitionSet.ORDERING_TOGETHER);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginFade(ViewGroup viewGroup) {
          Fade transition = new Fade();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }

          public static void beginChangeBounds(ViewGroup viewGroup) {
          ChangeBounds transition = new ChangeBounds();
          transition.setDuration(DURATION);
          TransitionManager.beginDelayedTransition(viewGroup, transition);
          }


          And when you want to animate layout changes you can just call one of this methods before layout changings:



          beginAuto(hiddenContainerParentLayout);
          hiddenContainer.setVisibility(hiddenContainer.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 14:35









          OnixOnix

          4478




          4478













          • Thanks, this works pretty well. However when hiding the view the scroll "collapses" immediately and not animated. Assume that the ScrollView currently shows the ToggleButton and the complete HiddenContainer. So the ToggleButton would be at the top of the screen. When hiding the HiddenContainer the buttom "jumps" to the bottom of the screen (since the scroll content does not fill the entire screen any more) and on can see how the bottom view animates towards the top view. So while the animation works fine, the size change of the scroll content happens immediately.

            – Andrei Herford
            Nov 14 '18 at 8:44











          • In this case you should call beginAuto for root layout of ScrollView, with this solusition when you change visibility of HiddenContainer animator also animate changing coordinates of BottomContainer in ScrollView

            – Onix
            Nov 14 '18 at 9:00











          • As shown in my post ScrollView is the root layout. Even when I add another layout to wrap ScrollView and apply beginAuto to this one, the result is absolutely the same.

            – Andrei Herford
            Nov 14 '18 at 9:23











          • You can try using beginChangeBounds instead of beginAuto, or call beginAuto for parent of ScrollView (or for root layout). I hope one of this solutions help you.

            – Onix
            Nov 14 '18 at 9:30











          • The transition type (auto, fade, changeBound, etc.) does not make any difference. As explained ScrollView IS the root layout (has no parent) and adding a parent also makes no difference.

            – Andrei Herford
            Nov 14 '18 at 9:39



















          • Thanks, this works pretty well. However when hiding the view the scroll "collapses" immediately and not animated. Assume that the ScrollView currently shows the ToggleButton and the complete HiddenContainer. So the ToggleButton would be at the top of the screen. When hiding the HiddenContainer the buttom "jumps" to the bottom of the screen (since the scroll content does not fill the entire screen any more) and on can see how the bottom view animates towards the top view. So while the animation works fine, the size change of the scroll content happens immediately.

            – Andrei Herford
            Nov 14 '18 at 8:44











          • In this case you should call beginAuto for root layout of ScrollView, with this solusition when you change visibility of HiddenContainer animator also animate changing coordinates of BottomContainer in ScrollView

            – Onix
            Nov 14 '18 at 9:00











          • As shown in my post ScrollView is the root layout. Even when I add another layout to wrap ScrollView and apply beginAuto to this one, the result is absolutely the same.

            – Andrei Herford
            Nov 14 '18 at 9:23











          • You can try using beginChangeBounds instead of beginAuto, or call beginAuto for parent of ScrollView (or for root layout). I hope one of this solutions help you.

            – Onix
            Nov 14 '18 at 9:30











          • The transition type (auto, fade, changeBound, etc.) does not make any difference. As explained ScrollView IS the root layout (has no parent) and adding a parent also makes no difference.

            – Andrei Herford
            Nov 14 '18 at 9:39

















          Thanks, this works pretty well. However when hiding the view the scroll "collapses" immediately and not animated. Assume that the ScrollView currently shows the ToggleButton and the complete HiddenContainer. So the ToggleButton would be at the top of the screen. When hiding the HiddenContainer the buttom "jumps" to the bottom of the screen (since the scroll content does not fill the entire screen any more) and on can see how the bottom view animates towards the top view. So while the animation works fine, the size change of the scroll content happens immediately.

          – Andrei Herford
          Nov 14 '18 at 8:44





          Thanks, this works pretty well. However when hiding the view the scroll "collapses" immediately and not animated. Assume that the ScrollView currently shows the ToggleButton and the complete HiddenContainer. So the ToggleButton would be at the top of the screen. When hiding the HiddenContainer the buttom "jumps" to the bottom of the screen (since the scroll content does not fill the entire screen any more) and on can see how the bottom view animates towards the top view. So while the animation works fine, the size change of the scroll content happens immediately.

          – Andrei Herford
          Nov 14 '18 at 8:44













          In this case you should call beginAuto for root layout of ScrollView, with this solusition when you change visibility of HiddenContainer animator also animate changing coordinates of BottomContainer in ScrollView

          – Onix
          Nov 14 '18 at 9:00





          In this case you should call beginAuto for root layout of ScrollView, with this solusition when you change visibility of HiddenContainer animator also animate changing coordinates of BottomContainer in ScrollView

          – Onix
          Nov 14 '18 at 9:00













          As shown in my post ScrollView is the root layout. Even when I add another layout to wrap ScrollView and apply beginAuto to this one, the result is absolutely the same.

          – Andrei Herford
          Nov 14 '18 at 9:23





          As shown in my post ScrollView is the root layout. Even when I add another layout to wrap ScrollView and apply beginAuto to this one, the result is absolutely the same.

          – Andrei Herford
          Nov 14 '18 at 9:23













          You can try using beginChangeBounds instead of beginAuto, or call beginAuto for parent of ScrollView (or for root layout). I hope one of this solutions help you.

          – Onix
          Nov 14 '18 at 9:30





          You can try using beginChangeBounds instead of beginAuto, or call beginAuto for parent of ScrollView (or for root layout). I hope one of this solutions help you.

          – Onix
          Nov 14 '18 at 9:30













          The transition type (auto, fade, changeBound, etc.) does not make any difference. As explained ScrollView IS the root layout (has no parent) and adding a parent also makes no difference.

          – Andrei Herford
          Nov 14 '18 at 9:39





          The transition type (auto, fade, changeBound, etc.) does not make any difference. As explained ScrollView IS the root layout (has no parent) and adding a parent also makes no difference.

          – Andrei Herford
          Nov 14 '18 at 9:39


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53282965%2fhow-to-animate-height-change-of-views-inside-a-linearlayout%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Error while running script in elastic search , gateway timeout

          Adding quotations to stringified JSON object values