为什么Androidx元素不起作用?这里不允许元素
我已经进行了一些更改以手动将应用迁移到Androidx,因为重构工具无法正常工作,之后。在我的 build.gradle
文件中更新了这些更改。一切正常,但是这样做:有一个资源文件不允许我使用 androidx
窗口小部件。在我的项目中,有一个重复的文件,其中一个更改可行,另一个更改则没有。其他文件,无论是否重复,都可以正常工作,并且该项目是同步,构建和启动的。
和错误文件。
所有元素中的错误:元素 com.google.android.material.appbar.appbar.appbarlayout
在这里不允许。我已经尝试清洁缓存并重新打开,并删除.IDEA文件夹,但仍无法正常工作。
我的问题:为什么所有这些文件都重复了?为什么我不能仅在这里使用小部件?
编辑: 我的.xml有来自Androidx和材料的资源
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
>
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:theme="@style/Theme.AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/Theme.AppTheme.PopupOverlay">
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/spn_documento_evento"
android:layout_width="match_parent"
style="@style/SpinnerAppCompat"
android:layout_height="match_parent">
</androidx.appcompat.widget.AppCompatSpinner>
</androidx.appcompat.widget.Toolbar>
<include layout="@layout/item_search"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="2dp">
<include layout="@layout/item_results_clear" />
<include layout="@layout/item_filters_activated" />
</LinearLayout>
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_documentos" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/floating_new_document"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:alpha="0.7"
android:layout_marginRight="@dimen/floating_margin"
android:layout_marginBottom="70dp"
android:src="@drawable/ic_add" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/floating_audit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:alpha="0.7"
android:layout_marginLeft="@dimen/floating_margin"
android:layout_marginBottom="70dp"
android:src="@drawable/ic_audit" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
gradle.properties文件
中添加以下内容,然后重建项目
Add following in
gradle.properties file
And then rebuild the project