英文:
Activity layout screen disappears when I add a tab layout
问题
我已经尝试刷新它,关闭应用程序然后重新打开它
我得到了三个渲染错误,错误消息如下:
未找到样式,ID为2131032999
样式资源引用{namespace=apk/res-auto,type=attr,name=textAppearanceButton}不是类型为STYLE的类型(而是attr类型)
英文:
This is how the screen looks, with nothing on it:
This is how the screen looks, when I add the tab layout:
I have tried refreshing it, closing the app and opening it again
I get three rendering errors with the following messages:
Failed to find style with 2131032999
Style ResourceReference{namespace=apk/res-auto, type=attr, name=textAppearanceButton} is not of type STYLE (instead attr)
java.lang.NullPointerException
at android.content.res.Resources_Theme_Delegate.obtainStyledAttributes(Resources_Theme_Delegate.java:74)
at android.content.res.Resources$Theme.obtainStyledAttributes(Resources.java:1631)
at android.content.Context.obtainStyledAttributes(Context.java:874)
at android.widget.TextView.setTextAppearance(TextView.java:3965)
at androidx.appcompat.widget.AppCompatTextView.setTextAppearance(AppCompatTextView.java:216)
at com.google.android.material.textview.MaterialTextView.setTextAppearance(MaterialTextView.java:106)
at android.widget.TextView.setTextAppearance(TextView.java:3954)
at androidx.core.widget.TextViewCompat.setTextAppearance(TextViewCompat.java:289)
at com.google.android.material.tabs.TabLayout$TabView.updateTab(TabLayout.java:2772)
at com.google.android.material.tabs.TabLayout$TabView.update(TabLayout.java:2801)
at com.google.android.material.tabs.TabLayout$TabView.setTab(TabLayout.java:2713)
at com.google.android.material.tabs.TabLayout.createTabView(TabLayout.java:1673)
at com.google.android.material.tabs.TabLayout.newTab(TabLayout.java:956)
at com.google.android.material.tabs.TabLayout.addTabFromItemView(TabLayout.java:824)
at com.google.android.material.tabs.TabLayout.addViewInternal(TabLayout.java:1730)
at com.google.android.material.tabs.TabLayout.addView(TabLayout.java:1720)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1131)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1130)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1101)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
at android.view.LayoutInflater.inflate(LayoutInflater.java:505)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:360)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:443)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:722)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$9(RenderTask.java:879)
at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$3.run(RenderExecutor.kt:194)
at com.android.tools.idea.rendering.RenderExecutor$PriorityRunnable.run(RenderExecutor.kt:292)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
答案1
得分: 2
将你的Android Studio项目中的Material Design库版本更改为1.8.0之前的版本,修改build.gradle文件中的依赖项如下:
dependencies {
'com.google.android.material:material:1.7.0'
}
英文:
Change the Material Design library version in your Android Studio project's build.gradle file to a version before 1.8.0.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
dependencies {
'com.google.android.material:material:1.7.0'
}
<!-- end snippet -->
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论