1

This is the structure of my layout xml:

<RelativeView>

    <ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

        <...>

    </ScrollView>

    <View
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone" />

</RelativeView>

When I want the view to appear, I use View.VISIBLE in the java file. I do this because I do not want the View to overlap the ScrollView.

Now, I want to animate the the view from View.GONE to View.VISIBLE, so that it looks good. I know that Animations can be done from Alpha 0 to 1. But is it possible to Animate from View.GONE to View.VISIBLE?

  • 2
    it is very much possible .. try adding `android:animateLayoutChanges="true"` in root layout . Or if you want to set some custom animation [Check this](https://developer.android.com/training/animation/reveal-or-hide-view). – ADM Jul 20 '20 at 09:35
  • Does this answer your question? [Android adding simple animations while setvisibility(view.Gone)](https://stackoverflow.com/questions/22454839/android-adding-simple-animations-while-setvisibilityview-gone) – danartillaga Jul 20 '20 at 11:45

1 Answers1

1

Add android:animateLayoutChanges="true" to your xml file and if you want fade out use view.animate().alpha(0.0f); in your java class and if you want fade in use view.animate().alpha(1.0f); .

Doxi67
  • 48
  • 6