gpt4 book ai didi

android - 无法使用 MaterialTextView

转载 作者:行者123 更新时间:2023-12-05 00:20:50 25 4
gpt4 key购买 nike

我正在使用 Material 组件,但不幸的是,我不能使用 MaterialTextView。我不知道我错过了什么。

在我的 build.gradle文件:

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'

在styles.xml 中:
    <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light" />

我这样定义了我的 TextView:
<MaterialTextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some text"
android:textStyle="bold" />

当我尝试启动应用程序时,我收到此错误: didn't find class android.view.MaterialTextView.
所以我尝试使用包名 com.google.android.material来指定但在自动完成结果 TextView 中没有出现。

最佳答案

MaterialTextView仍处于 alpha 状态,在 1.0.0 中不可用.要使用它,你应该

升级到最新的 Material 依赖 :

implementation 'com.google.android.material:material:1.1.0-alpha09'

关于android - 无法使用 MaterialTextView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57690848/

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