错误膨胀类-NestedScrollView-找不到类 [英] Error inflating class - NestedScrollView - class not found

查看:129
本文介绍了错误膨胀类-NestedScrollView-找不到类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行Android Studio 2.1.2,Windows 7.

Running Android Studio 2.1.2, Windows 7.

我用NestedScrollView替换了ScrollView,现在我得到

I replaced a ScrollView with a NestedScrollView and now I'm getting

android.view.InflateException:二进制XML文件第2行:错误 膨胀类NestedScrollView

android.view.InflateException: Binary XML file line #2: Error inflating class NestedScrollView

java.lang.ClassNotFoundException:未找到类 路径上的"android.view.NestedScrollView": /data/app/com.assemblyguide.remote-48.apk

java.lang.ClassNotFoundException: Didn't find class "android.view.NestedScrollView" on path: /data/app/com.assemblyguide.remote-48.apk

...当我在该XML文件上调用SetContentView()时.我只有ScrollView时没有得到它.

... when I call SetContentView() on that XML file. I did not get it when I had just a ScrollView.

我尝试清理,并使缓存无效并重建. XML看起来像这样. . .

I've tried cleaning, and invalidating the cache and rebuilding. The XML looks like this . . .

<?xml version="1.0" encoding="utf-8"?>
<NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <!-- This linear layout is because the scrollview can have only 1 direct child -->
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <!-- Relative layout for Workorder -->
        <RelativeLayout
            android:id="@+id/rellayWorkorder"
            android:background="#383838"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:layout_marginBottom="2dp">
            <TextView
                android:id="@+id/workorderlabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_margin="2dp"
                android:gravity="left"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="Work Order:"/>

            <TextView
                android:id="@+id/workorderContent"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_margin="2dp"
                android:gravity="right"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="---workorder---"/>
        </RelativeLayout>


        <!-- Relative layout for Required Time
   <FrameLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_gravity="center_horizontal"></FrameLayout> -->

        <RelativeLayout
            android:id="@+id/rellayRequiredTime"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:layout_marginBottom="2dp">
            <TextView
                android:id="@+id/requiredTimelabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_margin="2dp"
                android:gravity="left"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="Required Time:"/>

            <TextView
                android:id="@+id/requiredTimeContent"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_margin="2dp"
                android:gravity="right"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="--- 00 minutes ---"/>
        </RelativeLayout>

        <!-- Relative layout for Time remaining -->
        <RelativeLayout
            android:id="@+id/rellayTimeRemaining"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dp"
            android:layout_marginBottom="2dp">
            <TextView
                android:id="@+id/timeremaininglabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_margin="2dp"
                android:gravity="left"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="Time Remaining:"/>

            <TextView
                android:id="@+id/tviewtimeremainingContent"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_margin="2dp"
                android:gravity="right"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="--- 0:00:00---"/>
        </RelativeLayout>

        <!--  Linear layout for Record Start / Record End buttons -->
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"  >
            <Button
                android:id="@+id/debulkrecordStart"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="6dp"
                android:layout_marginRight="4dp"
                android:gravity="center"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:onClick="OnSetRecordStartTimeClick"
                android:text="Record Start"/>
            <Button
                android:id="@+id/debulkrecordEnd"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="6dp"
                android:layout_marginRight="4dp"
                android:gravity="center"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:onClick="OnSetRecordEndTimeClick"
                android:text="Record End"/>
        </LinearLayout>

        <!-- Relative layout for Vacuum level -->
        <RelativeLayout
            android:id="@+id/rellayvacuumlevel"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="2dp">
            <TextView
                android:id="@+id/vaclabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_margin="2dp"
                android:gravity="left"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="Vacuum Level (inches Hg):"/>
            <EditText
                android:id="@+id/vacleveledit"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight = "true"
                android:layout_margin="2dp"
                android:gravity="left"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:inputType="text|textCapCharacters"
                android:text="vac level"
                android:layout_marginRight="2dp"
                android:layout_marginTop="2dp"
                android:layout_marginBottom="2dp"/>
        </RelativeLayout>

        <!-- Relative layout for Vac Gauge Equipment # -->
        <RelativeLayout
            android:id="@+id/rlayvacuumGauge"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="2dp">
            <TextView
                android:id="@+id/vacgaugelabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_margin="2dp"
                android:gravity="left"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="Vac Gauge Equipment #:"/>
            <EditText
                android:id="@+id/vacgaugeedit"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight = "true"
                android:layout_margin="2dp"
                android:gravity="left"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:inputType="text|textCapCharacters"
                android:text="equip. #"/>
        </RelativeLayout>



        <!-- Relative layout for Calibration Due date -->
        <RelativeLayout
            android:id="@+id/rlaycalibdue"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="2dp">
            <TextView
                android:id="@+id/calibduelabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_margin="2dp"
                android:gravity="left"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:text="Calibration Due Date:"/>
            <EditText
                android:id="@+id/calibdueedit"
                android:layout_width="120dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight = "true"
                android:layout_margin="2dp"
                android:gravity="left"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:inputType="text|textCapCharacters"
                android:text="mm/dd/yyyy"/>
        </RelativeLayout>


        <CalendarView
            android:id="@+id/debulkcalendar"
            android:layout_width="300dp"
            android:layout_height="250dp"
            android:minDate="01/01/2016"
            android:maxDate="11/30/2016"
            />


        <!--  this linear layout is for the debulk override and done buttons  -->
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"  >
            <Button
                android:id="@+id/debulkOverride"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="6dp"
                android:layout_marginRight="4dp"
                android:onClick="OnResetClick"
                android:gravity="center"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="Override"/>
            <Button
                android:id="@+id/debulkDone"
                android:layout_width="150dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="6dp"
                android:layout_marginRight="2dp"
                android:onClick="onDoneBtnClick"
                android:gravity="center"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:text="Done"/>
        </LinearLayout>

    </LinearLayout>

</NestedScrollView>

此错误是什么意思,我该如何解决?

What does this error mean and how do I fix it?

推荐答案

完整的类名称为android.support.v4.widget.NestedScrollView.用<android.support.v4.widget.NestedScrollView>替换<NestedScrollView>元素,它应该可以正常工作.确保您的build.gradle文件中也有v4支持库.

The full class name is android.support.v4.widget.NestedScrollView. Replace the <NestedScrollView> element with <android.support.v4.widget.NestedScrollView> and it should work fine. Make sure you have the v4 support library in your build.gradle file, too.

这篇关于错误膨胀类-NestedScrollView-找不到类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆