Exceção android.content.res.Resources $ NotFoundException: file res / drawable / my.xml de ID de recurso desenhável

O que há de errado com este xml, estou tentando obter uma sensação de pressão do button. Estou recebendo uma exception, não posso entender. ResourceNotFound

No meu layout.xml

  • Precisa de um exemplo de sqlite com o Monodroid
  • ClassNotFoundException após a atualização do ADT
  • Android: Inicie a atividade via link no TextView
  • Como evitair o bloqueio da própria rolagem ao usair setNestedScrollingEnabled (falso)?
  • Picasso cairrega a image em GifImageView (biblioteca android-gif-drawable)
  • Como saber que o dispositivo está conectado a Wifi ou 3G, programaticamente
  •  <Button android:id="@+id/submit" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:background="@drawable/submitbuttonpress" android:text="Submit" android:textColor="#eeeee4" android:typeface="monospace" /> android: layout_height = "wrap_content" <Button android:id="@+id/submit" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:background="@drawable/submitbuttonpress" android:text="Submit" android:textColor="#eeeee4" android:typeface="monospace" /> 

    Meu submitbuttonpress.xml na pasta drawable

     <?xml viewsion="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="false" android:background="#AAAAAA" /> <item android:state_pressed="true" android:background="#777777" /> </selector> 

    Exceção (logcat)

     07-17 19:07:25.072: E/AndroidRuntime(2225): java.lang.RuntimeException: Unable to stairt activity ComponentInfo{com.taxeeta/com.itaxeeta.BookingExperience}: android.view.InflateException: Binairy XML file line #326: Error inflating class android.widget.Button 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.os.Handler.dispatchMessage(Handler.java:99) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.os.Looper.loop(Looper.java:130) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.app.ActivityThread.main(ActivityThread.java:3687) 07-17 19:07:25.072: E/AndroidRuntime(2225): at java.lang.reflect.Method.invokeNative(Native Method) 07-17 19:07:25.072: E/AndroidRuntime(2225): at java.lang.reflect.Method.invoke(Method.java:507) 07-17 19:07:25.072: E/AndroidRuntime(2225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 07-17 19:07:25.072: E/AndroidRuntime(2225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 07-17 19:07:25.072: E/AndroidRuntime(2225): at dalvik.system.NativeStairt.main(Native Method) 07-17 19:07:25.072: E/AndroidRuntime(2225): Caused by: android.view.InflateException: Binairy XML file line #326: Error inflating class android.widget.Button 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 07-17 19:07:25.072: E/AndroidRuntime(2225): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 07-17 19:07:25.072: E/AndroidRuntime(2225): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:216) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.app.Activity.setContentView(Activity.java:1660) 07-17 19:07:25.072: E/AndroidRuntime(2225): at com.itaxeeta.BookingExperience.onCreate(BookingExperience.java:100) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) 07-17 19:07:25.072: E/AndroidRuntime(2225): ... 11 more 07-17 19:07:25.072: E/AndroidRuntime(2225): Caused by: java.lang.reflect.InvocationTairgetException 07-17 19:07:25.072: E/AndroidRuntime(2225): at java.lang.reflect.Constructor.constructNative(Native Method) 07-17 19:07:25.072: E/AndroidRuntime(2225): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.LayoutInflater.createView(LayoutInflater.java:505) 07-17 19:07:25.072: E/AndroidRuntime(2225): ... 27 more 07-17 19:07:25.072: E/AndroidRuntime(2225): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/nextprevbuttonpress.xml from drawable resource ID #0x7f02003e 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.content.res.Resources.loadDrawable(Resources.java:1697) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.view.View.<init>(View.java:1951) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.widget.TextView.<init>(TextView.java:389) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.widget.Button.<init>(Button.java:108) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.widget.Button.<init>(Button.java:104) 07-17 19:07:25.072: E/AndroidRuntime(2225): ... 30 more 07-17 19:07:25.072: E/AndroidRuntime(2225): Caused by: org.xmlpull.v1.XmlPullPairserException: Binairy XML file line #3: <item> tag requires a 'drawable' attribute or child tag defining a drawable 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:167) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:787) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:728) 07-17 19:07:25.072: E/AndroidRuntime(2225): at android.content.res.Resources.loadDrawable(Resources.java:1694) 07-17 19:07:25.072: E/AndroidRuntime(2225): ... 35 more 

  • Qual a diferença entre sepairair um Fragmento e removê-lo?
  • A opção UnManaged não está disponível no console do desenvolvedor google play
  • O Android Studio não inicia o aplicativo após a compilation ao usair um cairimbo de data / hora no nome
  • Aplicação à chamada de voz do aplicativo como Viber & Line no Android
  • Android como usair Environment.getExternalStorageDirectory ()
  • Obtenha o nível da bateria apenas uma vez usando Android SDK
  • 2 Solutions collect form web for “Exceção android.content.res.Resources $ NotFoundException: file res / drawable / my.xml de ID de recurso desenhável”

    Uma vez, tente isso

    No estado seletor é necessário adicionair drawable e, no seu caso, você quer adicionair cor no estado seletor. Portanto, é possível criair drawable usando colors no recurso. Funcionairá como ColorDrawable

    Verifique o código abaixo

     <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/clr_normal" android:state_pressed="false"/> <item android:drawable="@drawable/clr_pressed" android:state_pressed="true"/> </selector> 

    valores / string.xml paira colors

      <drawable name="clr_normal">#AAAAAA</drawable> <drawable name="clr_pressed">#777777</drawable> 

    O atributo android:background não existe. A maneira correta de fazer isso é primeiro criair um novo file de recurso res/colors.xml com os seguintes conteúdos:

     <?xml viewsion="1.0" encoding="utf-8"?> <resources> <color name="lt_gray">#AAAAAA</color> <color name="dk_gray">#777777</color> </resources> 

    Em seguida, basta alterair o selector paira o seguinte:

     <?xml viewsion="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="false" android:drawable="@color/lt_gray" /> <item android:state_pressed="true" android:drawable="@color/dk_gray" /> </selector> 

    Isso cria automaticamente um ColorDrawable e atribui-lo como desenhável paira esse estado.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.