title: How to wait with Fragment Transaction until Fragment View is created
body: <p>Is there any way to wait with the animation of a Fragment Transaction until the view of the new Fragment is completely created?</p>
  
  <p>Any help is much appreciated.</p>
  
  <p>Creating the view in my case takes some time because constraints are being set and text is being formated with SpannableStringBuilder. Therefore the animation is being skipped in most cases because there is too much work on the main thread.</p>
  
  <pre><code>// Kotlin
  
  val newFragment = MyFragment()
  val backStackName = "myfragment"
  
  val fragmentManager = activity.supportFragmentManager
  val fragmentTransaction = fragmentManager.beginTransaction()
  
  fragmentTransaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_right, R.anim.slide_in_right, R.anim.slide_out_right)
  fragmentTransaction.add(R.id.MyFragmentLayout, newFragment)
  fragmentTransaction.addToBackStack(backStackName)
  fragmentTransaction.commit()
  </code></pre>