未能在当前主题中找到’@attr/TextAppearanceButton’。

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

failed to find '@attr/TextAppearanceButton' in current theme

问题

我想在我的安卓项目应用中添加扩展浮动操作按钮,但是遇到一个错误,提示在当前主题中找不到@attr/TextAppearanceButton。我已经在 build.gradle 模块中导入了 Material 依赖。我是安卓开发的新手。请求帮助 🙏😊。

英文:

I want to add Extended floating action button to my android project app but got an error saying failed to find @attr/TextAppearanceButton in current theme. I have implemented material dependency in build.grade module. I am new to Android Development. Please I need a help 🙏🏾.

答案1

得分: 3

更改你的 styles.xml 如下所示:

<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
英文:

change your styles.xml to like below

&lt;style name=&quot;AppTheme&quot; parent=&quot;Theme.MaterialComponents.Light.NoActionBar&quot;&gt;

答案2

得分: 3

我之前也遇到了在将我的Android Studio更新到DOPLPHIN后渲染XML文件的问题。

在你的XML文件中,在父布局中添加android:theme="@style/YOUR_MATERIAL_THEME",所有的渲染问题都会消失。

或者

在你的清单文件中,在<application下面添加android:theme="@style/YOUR_MATERIAL_THEME"。

我希望这能解决你的问题。

英文:

I was also facing the issue of rendering xml files after updating my android studio to DOPLPHIN.

In your xml, add android:theme="@style/YOUR_MATERIAL_THEME" to your parent layout and all rendering issues will be gone.

                   OR

In your manifest file under <application add android:theme="@style/YOUR_MATERIAL_THEME"

I hope this fixes your issue.

答案3

得分: -1

你可以用 ?attr/ 而不是 @attr/ 来引用它们。例如 - ?attr/colorPrimary

英文:

You can refer to them by ?attr/ and not @attr/. Example - ?attr/colorPrimary.

huangapple
  • 本文由 发表于 2020年10月13日 13:33:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/64329125.html
匿名

发表评论

匿名网友

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

确定