2013-01-19 57 views
3

我有这个简单的LinearLayout,它在图形布局中显示得很好,但是当我构建项目时,我得到这个控制台错误(我在这里丢失了什么?):在包'android'中找不到属性'layout_weightSum'的资源标识符

在包 '机器人'

在这里找到的属性 'layout_weightSum' 没有资源标识符是布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_weightSum="3" 
    android:baselineAligned="false" 
    android:orientation="horizontal" > 

    <LinearLayout 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" > 

     <TextView 
      android:id="@+id/tvSpine" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Spine"/> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" > 

     <TextView 
      android:id="@+id/tvPage" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Page"/> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" > 

     <TextView 
      android:id="@+id/tvThick" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Thick"/> 
    </LinearLayout> 
</LinearLayout> 

+0

有趣的是,这个回答的帖子从未被纠正过:http://stackoverflow.com/questions/10250020/how-do-i-get-six-buttons-to-resize-based-on-the-screen-size/10250213#10250213并且图形布局认为该参数是好的。 – KiloOne

回答

6

更改:

android:layout_weightSum="3" 

要:

android:weightSum="3" 

没有layout前缀此参数。

+0

我喜欢简单修复,谢谢 – KiloOne

相关问题