title: How can I load a specified Animator from StateListAnimator xml file programatically?
body: <p>Is it possible to programatically load specified animator class from StateListAnimator defined on xml file so that I can add listener to it programatically?</p>
  
  <p>I know we can do that with simple Animator xml file, but not for any xml that represents StateListAnimator. I have tried applying ID to the animator class on xml but it seems we can't apply any IDs to it. </p>
  
  <p>Below is my code to load state list animator from xml and the content of xml file.</p>
  
  <p>Thanks in advance!</p>
  
  <p>On API level 21 or above:</p>
  
  <pre><code>AnimatorInflater.loadStateListAnimator(
      getContext(), R.animator.state_list_animator);
  </code></pre>
  
  <p>Below is my state_list_animator xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:state_selected="false"&gt;
          &lt;set&gt;
              &lt;objectAnimator android:duration="@android:integer/config_shortAnimTime"
                              android:propertyName="rotation"
                              android:valueTo="0f"
                              android:valueType="floatType"
                      /&gt;
          &lt;/set&gt;
      &lt;/item&gt;
      &lt;item android:state_selected="true"&gt;
          &lt;set&gt;
              &lt;objectAnimator
                      android:duration="@android:integer/config_shortAnimTime"
                              android:propertyName="rotation"
                              android:valueTo="180f"
                              android:valueType="floatType"/&gt;
          &lt;/set&gt;
      &lt;/item&gt;
  &lt;/selector&gt;
  </code></pre>