Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 布局中的“权重”属性(<;包括>;标签_Android - Fatal编程技术网

Android 布局中的“权重”属性(<;包括>;标签

Android 布局中的“权重”属性(<;包括>;标签,android,Android,我正在尝试使用标记重用android应用程序中的一些布局组件。我有不同的港口和陆地布局: 端口: <LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp"> <include layout="@layout/calc_equals_button" a:layout_weight="4"/> <include layout="@layou

我正在尝试使用
标记重用android应用程序中的一些布局组件。我有不同的港口和陆地布局:

  • 端口:

    <LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
    
        <include layout="@layout/calc_equals_button" a:layout_weight="4"/>
        <include layout="@layout/calc_display"/>
    
    </LinearLayout>
    
    否则——不是

    下面是calc_equals_button.xml的示例:

    <DirectionDragButton
        xmlns:a="http://schemas.android.com/apk/res/android"
        a:id="@+id/equalsButton"
        a:text="="
        a:layout_width="match_parent"
        a:layout_height="match_parent"
        style="@style/control_button_style"
        a:onClick="numericButtonClickHandler"/>
    
    
    
    当前的限制是,您必须为要应用的其他布局属性指定布局宽度和布局高度。

    ICS中的“当前”将被更改?但这如何有助于解决此问题?@MichellBak否,此限制在ICS中仍然存在。@se.solovyev它解决了您的问题。。。include标记必须指定要考虑的重量的宽度和高度。
    <LinearLayout a:layout_weight="1" a:layout_width="match_parent" a:layout_height="0dp">
            <DirectionDragButton
                    xmlns:a="http://schemas.android.com/apk/res/android"
                    a:id="@+id/equalsButton"
                    a:text="="
                    a:layout_width="match_parent"
                    a:layout_height="match_parent"
                    a:layout_weight="4"
                    style="@style/control_button_style"
                    a:onClick="numericButtonClickHandler"/>
    
            <include layout="@layout/calc_display"/>
    
        </LinearLayout>
    
    <DirectionDragButton
        xmlns:a="http://schemas.android.com/apk/res/android"
        a:id="@+id/equalsButton"
        a:text="="
        a:layout_width="match_parent"
        a:layout_height="match_parent"
        style="@style/control_button_style"
        a:onClick="numericButtonClickHandler"/>