android 添加选项卡布局时,活动布局屏幕消失

pn9klfpd  于 2023-04-04  发布在  Android
关注(0)|答案(1)|浏览(156)

这是屏幕的样子,上面什么都没有:

这是当我添加选项卡布局时屏幕的外观:

我已经尝试过刷新它,关闭应用程序并再次打开它
我得到三个渲染错误,并显示以下消息:
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)
9rbhqvlz

9rbhqvlz1#

将Android Studio项目的build.gradle文件中的Material Design库版本更改为1.8.0之前的版本。

dependencies {
  'com.google.android.material:material:1.7.0'
 }

相关问题