我在 android studio 中使用 CoordinatorTabLayout 时出错
I am getting error while using CoordinatorTabLayout in android studio
我在 android studio 中导入 CoordiatorTabLayout 时遇到错误 Class referenced in the layout file, cn.hugeterry.coordinatortablayout.CoordinatorTabLayout, was not found in the project or the libraries
这里是错误的截图
<?xml version="1.0" encoding="utf-8"?>
<cn.hugeterry.coordinatortablayout.CoordinatorTabLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinatortablayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.prosec.Safety">
<android.support.v4.view.ViewPager
android:id="@+id/vp"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</cn.hugeterry.coordinatortablayout.CoordinatorTabLayout>
您添加了 cn.hugeterry.coordinatortablayout.CoordinatorTabLayout
布局的依赖项?因为这是自定义 Layout
,而不是 android 提供的布局。您必须添加依赖项才能使用自定义布局。如果您使用 android 默认 coordinator
布局,则这不是 android 默认。 android 默认布局如下。
<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"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.coordinatorlayout.widget.CoordinatorLayout>
如果您的 coordinatorLayout 是 android 默认值,请按照我上面添加的方式进行布局。如果问题相同,请告诉我
我在 android studio 中导入 CoordiatorTabLayout 时遇到错误 Class referenced in the layout file, cn.hugeterry.coordinatortablayout.CoordinatorTabLayout, was not found in the project or the libraries
这里是错误的截图
<?xml version="1.0" encoding="utf-8"?>
<cn.hugeterry.coordinatortablayout.CoordinatorTabLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinatortablayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.prosec.Safety">
<android.support.v4.view.ViewPager
android:id="@+id/vp"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</cn.hugeterry.coordinatortablayout.CoordinatorTabLayout>
您添加了 cn.hugeterry.coordinatortablayout.CoordinatorTabLayout
布局的依赖项?因为这是自定义 Layout
,而不是 android 提供的布局。您必须添加依赖项才能使用自定义布局。如果您使用 android 默认 coordinator
布局,则这不是 android 默认。 android 默认布局如下。
<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"
android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.coordinatorlayout.widget.CoordinatorLayout>
如果您的 coordinatorLayout 是 android 默认值,请按照我上面添加的方式进行布局。如果问题相同,请告诉我