在下面的代码中,Android studio提示
 Layout weights require a widget to be measured twice. When a LinearLayout 
 with non-zero weights is nested inside another LinearLayout with non-zero 
 weights ,then the number of measurements increases exponently.这要怎么改?
//这段是从一段里截取的
   <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1">
        <Button
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:text="@string/again"
            android:id="@+id/again"
            android:layout_weight="1"/>
        <Button
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:text="@string/confirm"
            android:id="@+id/confirm"
            android:layout_weight="1" />
    </LinearLayout>版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
你就一个LinearLayout,你怎么用weight属性呢,两个button有一个父LinearLayout,此LinearLayout有宽度故可以用weight。如果你的LinearLayout也有父节点,就可以用weight。
 android:orientation="horizontal"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content" >
 <!--设置高度,去掉weight-->
    <Button
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:text="@string/again"
        android:id="@+id/again"
        android:layout_weight="1"/>
    <Button
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:text="@string/confirm"
        android:id="@+id/confirm"
        android:layout_weight="1" />
</LinearLayout>   <LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1">
    <Button
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:text="@string/again"
        android:id="@+id/again"
        android:layout_weight="1"/>
    <Button
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:text="@string/confirm"
        android:id="@+id/confirm"
        android:layout_weight="1" />
</LinearLayout>