当我添加一个标签布局时,活动布局屏幕消失。

huangapple go评论81阅读模式
英文:

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 {
  &#39;com.google.android.material:material:1.7.0&#39;
 }

<!-- end snippet -->

huangapple
  • 本文由 发表于 2023年3月9日 20:44:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/75684805.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定