2014-03-05 83 views
0

我有以下XML文件被誇大,我不知道爲什麼我會收到錯誤。下面是XML文件:您必須提供layout_width屬性

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/transitionForm" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@color/backgroundcolor" 
android:orientation="horizontal" > 

<include 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    layout="@layout/assistekborders" /> 

<include 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    layout="@layout/assistek_pro_borderwidgets" /> 

<include 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    layout="@layout/assistek_pro_questionlabels" /> 

<include 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    layout="@layout/assistek_pro_practicesessionwidgets" /> 

<include 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    layout="@layout/assistek_pro_progress" /> 

<ScrollView 
    android:id="@+id/svPRORGWidgets" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/ImageBottom" 
    android:layout_below="@+id/lblSubQuestionText" 
    android:layout_marginBottom="30px" 
    android:layout_marginRight="50px" 
    android:layout_marginTop="30px" 
    android:layout_toRightOf="@+id/lblQuestionNumber" 
    android:descendantFocusability="beforeDescendants" > 
    <!-- 
    <TableLayout 
     android:id="@+id/tableLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <TableRow 
    android:id="@+id/tableRow1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:padding="5dip" > 
    --> 
    <RadioGroup 
     android:id="@+id/radioGroup" 
     android:layout_width="fill_parent" 
     android:layout_column="1" 
     android:layout_height="wrap_content" > 
    </RadioGroup> 
    <RadioGroup 
     android:id="@+id/radioGroup2" 
     android:layout_width="fill_parent" 
     android:layout_column="2" 
     android:layout_height="wrap_content" > 
    </RadioGroup> 
    <!-- 
    </TableRow> 
    </TableLayout> 
    --> 
</ScrollView> 

這裏是logcat的錯誤。我沒有看到問題是什麼 - 我的所有元素都有一個layout_width屬性。

04-15 21:02:31.800: E/AndroidRuntime(3577): FATAL EXCEPTION: main 
04-15 21:02:31.800: E/AndroidRuntime(3577): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.assistek.ediary/com.assistek.ediary.RadioGroupQuestionnaire}: java.lang.RuntimeException: Binary XML file line #46: You must supply a layout_width attribute. 
04-15 21:02:31.800: E/AndroidRuntime(3577):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 
04-15 21:02:31.800: E/AndroidRuntime(3577):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
04-15 21:02:31.800: E/AndroidRuntime(3577):  at android.app.ActivityThread.access$600(ActivityThread.java:141) 
+0

如果需要,檢查所有包含佈局的佈局是否都使用了'android:layout_width'屬性。運行Android lint工具來幫助追蹤問題。 –

+0

Lint提出了banannn提供的答案。 –

回答

0

ScrollView只能有一個孩子。

嘗試將您的RadioGroup放入LinearLayout或RelativeLayout中。

+0

謝謝 - 這是問題! –

相關問題