[英]I am getting error while using CoordinatorTabLayout in android studio
我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提供的Layout。 您必須添加依賴項才能使用自定義布局。 如果您使用 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 默認值,那么按照我上面添加的方式進行布局。 如果問題相同,請告訴我
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.