当我尝试在xml文件中添加 SlidingTabLayout 时,会出现错误
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/DrawerLayoutTop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="7dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/tool_bar"
layout="@layout/tool_bar">
</include>
<com.android4devs.slidingtab.SlidingTabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="2dp"
android:background="@color/ColorPrimary"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_weight="1"
></android.support.v4.view.ViewPager>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/RecyclerView"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:background="#ffffff"
android:scrollbars="vertical">
</android.support.v7.widget.RecyclerView>
这是logcat
引起:java.lang.ClassNotFoundException:未在路径上找到类“com.android4devs.slidingtab.SlidingTabLayout”:DexPathList [[zip file“/data/app/com.example.myapplication-1.apk” ],nativeLibraryDirectories = [/ data / app-lib / com.example.myapplication-1,/ vendor / lib,/ system / lib]]
我该如何纠正?
答案 0 :(得分:1)
这可能是因为
<style>
@body-color:#f00;
body {
color:@body-color;
}
</style>
请验证SlidingTabLayout的路径。应该是你的.package.SlidiingTabLayout