Home > front end >  I am getting error while using CoordinatorTabLayout in android studio
I am getting error while using CoordinatorTabLayout in android studio

Time:04-14

I am getting an error Class referenced in the layout file, cn.hugeterry.coordinatortablayout.CoordinatorTabLayout, was not found in the project or the libraries while importing CoordiatorTabLayout in android studio here screenshot of the errorclick here

<?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>

CodePudding user response:

You added dependency of cn.hugeterry.coordinatortablayout.CoordinatorTabLayout layout? Because this is custom Layout, not android provided Layout. You have to add the dependency to use a custom Layout. If you use the android default coordinator layout then this is not android default. The android default layout is below.

<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>

If your coordinatorLayout is android default then make your layout as above I added. If problem is same, let me know

  • Related