gpt4 book ai didi

android - 资源 "XX"(7f07005e) 不是 Drawable(颜色或路径): TypedValue{t=0x1/d=0x7f07005e a=-1 r=0x7f07005e}

转载 作者:太空狗 更新时间:2023-10-29 15:49:59 26 4
gpt4 key购买 nike

当我启动我的应用程序时,出现此错误(仅在 api 22 中),显然这是我为 button_login 所做的自定义背景的一些错误

Error: android.content.res.Resources$NotFoundException: Resource"br.com.tecmafandroid.projeto.tecmaf:drawable/backgroud_botao_login"(7f07005e) is not a Drawable (color or path):TypedValue{t=0x1/d=0x7f07005e a=-1 r=0x7f07005e}

我的 logcat 错误是:

   Caused by: android.content.res.Resources$NotFoundException: Resource "br.com.tecmafandroid.projeto.tecmaf:drawable/backgroud_botao_login" (7f07005e)  is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f07005e a=-1 r=0x7f07005e}
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2441)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.view.View.<init>(View.java:3737)
at android.widget.TextView.<init>(TextView.java:637)
at android.widget.Button.<init>(Button.java:111)
at android.widget.Button.<init>(Button.java:107)
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:70)
at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:66)
at android.support.v7.app.AppCompatViewInflater.createButton(AppCompatViewInflater.java:186)
at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:109)
at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1035)
at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1092)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
at br.com.tecmafandroid.projeto.tecmaf.activity.TelaInicialActivity.onCreate(TelaInicialActivity.java:24) 
at android.app.Activity.performCreate(Activity.java:5990) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

activity_tela_inicial(调用按钮的 xml):

    <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:background="@drawable/background_degrade"
tools:context=".activity.TelaInicialActivity">

<Button
android:id="@+id/btFacaLogin"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginBottom="24dp"
android:background="@drawable/backgroud_botao_login"
android:text="Faça Login"
android:textColor="@color/textColorButton"
app:layout_constraintBottom_toTopOf="@+id/textView6"
app:layout_constraintEnd_toEndOf="@+id/textView6"
app:layout_constraintStart_toStartOf="@+id/textView6" />

</android.support.constraint.ConstraintLayout>

background_botao_login(xml backgroud_botao_login):

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<corners android:radius="20dp"></corners>

<solid android:color="#FFFFFF"></solid>

<stroke
android:width="1dp"
android:color="#C9DBE9"></stroke>

</shape>

最佳答案

当您将 xml 放在错误的 drawable 文件夹中时,我已经看到这个问题发生了。例如在 drawable-v24 中,它会在 API < 21 上崩溃。

可以将background_botao_login.xml粘贴到没有api版本的drawable中解决问题。

右键点击 background_botao_login 并点击 show in folder (linux 中的文件) 然后复制它并转到上一个文件夹并找到 drawable 并粘贴到其中。

关于android - 资源 "XX"(7f07005e) 不是 Drawable(颜色或路径): TypedValue{t=0x1/d=0x7f07005e a=-1 r=0x7f07005e},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52816783/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com