title: Android - Animation from invisible to visible
body: <p>I was trying to animate a text view with the following code</p>
  
  <p>layout/fragment_testing.xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.onthego.OnTheGoFragment"&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="60dp"
          android:text="Heading test"
          android:gravity="center"
          android:layout_marginTop="150dp"
          android:textAlignment="center"
          android:textColor="@android:color/black"
          android:textSize="@dimen/heading_level_2"
          android:id="@+id/otg_main_title_tv"/&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="@dimen/otg_main_menu_item_height"
          android:layout_marginTop="10dp"
          android:layout_marginStart="@dimen/otg_main_menu_item_magin_side"
          android:layout_marginEnd="@dimen/otg_main_menu_item_magin_side"
          android:id="@+id/otg_main_rapid_test_tv"
          android:text="Rapid Test"
          android:textSize="@dimen/text_size_1"
          android:textColor="@android:color/black"
          android:textAlignment="center"
          android:gravity="center"
          android:background="@drawable/otg_menu_item_bg"
          android:layout_below="@id/otg_main_title_tv"/&gt;
  
      &lt;ImageView
          android:layout_width="@dimen/otg_main_menu_item_height"
          android:layout_height="@dimen/otg_main_menu_item_height"
          android:layout_alignTop="@id/otg_main_rapid_test_tv"
          android:layout_alignStart="@id/otg_main_rapid_test_tv"
          android:background="@drawable/otg_menu_item_bg"
          android:padding="@dimen/otg_main_menu_item_icon_padding"
          android:src="@drawable/ic_chevron_right_black_48dp"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Testfragment.java</p>
  
  <pre><code>public class Testfragment extends Fragment {
  
      private TextView mTvOtgRapidTest;
      private Activity    mActivity;
      private Context     mContext;
  
      public Testfragment () {
          // Required empty public constructor
      }
  
      @Override
      public void onAttach(Context context) {
          super.onAttach(context);
          if(mContext == null) {
              mContext = context;
              mActivity = (MainActivity) getActivity();
          }
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          View root = inflater.inflate(R.layout.fragment_testing, container, false);
          mTvOtgRapidTest = (TextView) root.findViewById(R.id.otg_main_rapid_test_tv);
  
          new Handler().postDelayed(new Runnable() {  //To ensure if the view is visible on fragment attach
              @Override
              public void run() {
                  setMenuAnimation();
              }
          }, 2000);
  
          return root;
      }
  
  
      private void setMenuAnimation() {
          Animation menuItemAnimation = AnimationUtils.loadAnimation(mActivity, R.anim.menu_item_scale_x_up);
          mTvOtgRapidTest.startAnimation(menuItemAnimation);
  
          mTVOtgStamina.startAnimation(menuItemAnimation);
      }
  
  }
  </code></pre>
  
  <p>Here what I am trying to do is, the view should be invisible on attaching the fragment and after the animation, It should be visible.</p>
  
  <p>But what happening here is the view will be visible on attaching the fragment, and start animation.</p>
  
  <p>How I make the text view from invisible state to visible by animation?</p>