android微调器:渲染期间引发异常

android微调器:渲染期间引发异常,android,xml,android-spinner,Android,Xml,Android Spinner,当我在xml中添加了微调器时,在呈现过程中引发了一个异常:二进制xml文件行#-1:错误膨胀类 单击详细信息,我看到以下错误 我以编程方式填充微调器 以下是我的XML: <?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content"

当我在xml中添加了
微调器
时,在呈现过程中引发了一个
异常:二进制xml文件行#-1:错误膨胀类

单击详细信息,我看到以下错误

我以编程方式填充
微调器

以下是我的XML:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:weightSum="2">

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal">

        <TextView
            android:id="@+id/title"
            android:layout_weight="2"
            android:textAppearance="?android:attr/textAppearanceLarge" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/title" />

        <EditText
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/description" />

        <EditText
            android:id="@+id/description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:inputType="textMultiLine" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/packaging" />

        <EditText
            android:id="@+id/packaging"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:inputType="textMultiLine" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/price" />

        <EditText
            android:id="@+id/price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:inputType="numberDecimal" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/available_count" />

        <EditText
            android:id="@+id/availableCount"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:inputType="number" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/category" />

        <Spinner
            android:id="@+id/category"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:spinnerMode="dropdown" />
    </TableRow>

    <TableRow
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal">

        <Button
            android:id="@+id/save_product"
            android:layout_weight="2"
            android:text="@string/change_product_details" />
    </TableRow>

</TableLayout>


您的代码看起来不错,可能是android studio无法重建代码。让我们重建代码,然后重新运行。

使用最新版本的android studio 2.2,它将解决许多此类问题。它的重量也比以前的所有版本都轻。我在他们的网站上看到的最新版本是2.1,下面是android studio最新版本的url,请仔细阅读内容并下载。