title: Animated toggle button Error inflating class android.widget.ToggleButton
body: <p>im trying to make a toggle button with animation i use a toggle button and 4 XML to do so :
  here is my main activity which toggle button is in it :</p>
  
  <pre><code>&lt;ToggleButton
      android:id="@+id/toggle"
      android:layout_width="144dp"
      android:layout_height="144dp"
      android:layout_centerHorizontal="true"
      android:layout_centerVertical="true"
      android:background="@drawable/btn_toggle_bg"
      android:checked="true"
      android:onClick="OnPressToggle" /&gt;
  </code></pre>
  
  <p>and here is my btn_toggle_bg . xml which had background values :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout&gt;
  &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;item android:id="@+android:id/background" android:drawable="@android:color/transparent" /&gt;
  &lt;item android:id="@+android:id/toggle" android:drawable="@drawable/btn_toggle" /&gt;
  &lt;/layer-list&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and here is my btn_toggle . 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_checked="true"  android:drawable="@drawable/btn_switch_on" /&gt;
  &lt;item android:state_checked="false"  android:drawable="@drawable/btn_switch_off" /&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>here is the new log cat </p>
  
  <pre><code>09-26 03:25:36.856: E/AndroidRuntime(19979): FATAL EXCEPTION: main
  09-26 03:25:36.856: E/AndroidRuntime(19979): Process: com.soheil.prolight, PID: 19979
  09-26 03:25:36.856: E/AndroidRuntime(19979): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.soheil.prolight/com.soheil.prolight.MainActivity}: android.view.InflateException: Binary XML file line #37: Error inflating class android.widget.ToggleButton
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.os.Handler.dispatchMessage(Handler.java:102)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.os.Looper.loop(Looper.java:136)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.app.ActivityThread.main(ActivityThread.java:5017)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at java.lang.reflect.Method.invokeNative(Native Method)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at java.lang.reflect.Method.invoke(Method.java:515)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at dalvik.system.NativeStart.main(Native Method)
  09-26 03:25:36.856: E/AndroidRuntime(19979): Caused by: android.view.InflateException: Binary XML file line #37: Error inflating class android.widget.ToggleButton
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.LayoutInflater.createView(LayoutInflater.java:620)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:631)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.LayoutInflater.inflate(Native Method)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.app.Activity.setContentView(Activity.java:1929)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at com.soheil.prolight.MainActivity.onCreate(MainActivity.java:84)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.app.Activity.performCreate(Activity.java:5231)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    ... 12 more
  09-26 03:25:36.856: E/AndroidRuntime(19979): Caused by:   java.lang.reflect.InvocationTargetException
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at java.lang.reflect.Constructor.constructNative(Native Method)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.LayoutInflater.createView(LayoutInflater.java:594)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    ... 28 more
  09-26 03:25:36.856: E/AndroidRuntime(19979): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-hdpi/btn_toggle_bg.xml from drawable resource ID #0x7f020005
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.content.res.Resources.loadDrawable(Resources.java:2096)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.content.res.XResources$XTypedArray.getDrawable(XResources.java:965)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.view.View.&lt;init&gt;(View.java:3554)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.widget.TextView.&lt;init&gt;(TextView.java:623)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.widget.Button.&lt;init&gt;(Button.java:107)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.widget.CompoundButton.&lt;init&gt;(CompoundButton.java:68)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.widget.ToggleButton.&lt;init&gt;(ToggleButton.java:51)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.widget.ToggleButton.&lt;init&gt;(ToggleButton.java:64)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    ... 31 more
  09-26 03:25:36.856: E/AndroidRuntime(19979): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #2: invalid drawable tag LinearLayout
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    at android.content.res.Resources.loadDrawable(Resources.java:2092)
  09-26 03:25:36.856: E/AndroidRuntime(19979):    ... 39 more
  </code></pre>