Java 二进制XML文件第41行:必须提供布局宽度属性

Java 二进制XML文件第41行:必须提供布局宽度属性,java,android,xml,Java,Android,Xml,嘿,伙计们,我正在开发一个android应用程序,当按下Equatime按钮时,它应该会打开Moainstallerview.java,但当我测试该应用程序时,该应用程序崩溃:(logcat给出此错误: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.d4a.stz/jp.yhonda.MOAInstallerActivity}: java.lang.RuntimeException: Binary X

嘿,伙计们,我正在开发一个android应用程序,当按下Equatime按钮时,它应该会打开Moainstallerview.java,但当我测试该应用程序时,该应用程序崩溃:(logcat给出此错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.d4a.stz/jp.yhonda.MOAInstallerActivity}: java.lang.RuntimeException: Binary XML file line #41: You must supply a layout_width attribute.
这是我的密码:

moainstallerview.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MOAInstallerActivity" >

    <CheckedTextView
        android:id="@+id/checkedTextView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="8dp"
        android:text="Equation Time on Android installs additional 85MB of data. Please                 choose the install location and press Install." />

    <RadioGroup
        android:id="@+id/radiogroup"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <RadioButton
            android:id="@+id/radioButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Internal Storage" />

        <RadioButton
            android:id="@+id/radioButton2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="External Storage (SD Card)" />
    </RadioGroup>

    <!-- Push the button bar to the bottom -->
    <View
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_weight="1" />

    <!-- Divider above the button bar -->
    <View style="?attr/buttonBarDividerStyle" />

    <LinearLayout
        style="?attr/buttonBarStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/button2"
            style="?attr/buttonBarButtonStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Cancel" />

        <Button
            android:id="@+id/equtime"
            style="?attr/buttonBarButtonStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Install" />
    </LinearLayout>

</LinearLayout>
moaaInstallerView.xml
我很沮丧,所以任何帮助都会让人惊讶,我是一个android新手,所以请不要评判

问候

Rapsong11

错误消息显示“二进制XML文件行41:必须提供布局宽度属性。”

第41行如下。此处的
视图
标记需要具有
布局宽度
布局高度
属性:

<View style="?attr/buttonBarDividerStyle" />

例如:

<View android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     style="?attr/buttonBarDividerStyle" />

根据错误消息,您需要在buttonBarDividerStyle视图中添加布局宽度属性

试试这个:

<View style="?attr/buttonBarDividerStyle" android:layout_width="match_parent" />

对我来说,在我的一个layout.xml文件中

<ImageView
    android:id="@+id/row_1_col_0"
    android:layout_width="@string/default_picture_size"
    android:layout_height="@string/default_picture_size"
    android:layout_weight="1"
    android:background="@drawable/tile"
    android:onClick="mClickMethod" >
</ImageView>


一切正常。

这还不够。这只会导致错误消息,说明也需要布局高度。
<ImageView
    android:id="@+id/row_1_col_0"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@drawable/tile"
    android:onClick="mClickMethod" >
</ImageView>
android:layout_width="@string/default_picture_size"
android:layout_height="@string/default_picture_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"