Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.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_Button_Tablerow_Android Tablelayout - Fatal编程技术网

Android “如何适应”;按钮“;在框架中使用;表行“?”;?

Android “如何适应”;按钮“;在框架中使用;表行“?”;?,android,button,tablerow,android-tablelayout,Android,Button,Tablerow,Android Tablelayout,我正在做一个计算器,但在框架内,它不合适 我在里面使用“表格布局” 但它显示了这一点 当我想这样做的时候 请帮助,如何将我的按钮正确地固定在框架内?谢谢 这是我的“按钮”源代码 在最后3个按钮的xml中,您编写了android:weight=“1”,它将成为android:layout\u weight=“1” <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:too

我正在做一个计算器,但在框架内,它不合适

我在里面使用“表格布局”

但它显示了这一点

当我想这样做的时候

请帮助,如何将我的按钮正确地固定在框架内?谢谢

这是我的“按钮”源代码


在最后3个按钮的xml中,您编写了android:weight=“1”,它将成为android:layout\u weight=“1”


<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">

    <TextView
        android:id="@+id/textView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:background="#cccccc" 
        android:padding="15dp"/>

    <TableLayout
        android:id="@+id/tableID"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp">

        <TableRow>
             <Button
                android:id="@+id/btn7"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="7"/>

             <Button
                android:id="@+id/btn8"
                android:text="8"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"/>

             <Button
                 android:id="@+id/btn9"
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
                 android:text="9"
                 android:layout_weight="1"/>

             <Button
                 android:id="@+id/btnDivide"
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
                 android:text="÷"
                 android:layout_weight="1"/>     
        </TableRow>

        <TableRow>

            <Button
                android:id="@+id/btn4"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="4"
                android:layout_weight="1"/>

            <Button
                android:id="@+id/btn5"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="5"
                android:weight="1"/>

            <Button
                android:id="@+id/btn6"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="6"
                android:weight="1"/>

            <Button
                android:id="@+id/btn7"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="7"
                android:weight="1"/>

       </TableRow>
    </TableLayout>
</LinearLayout>
    <TableRow>

        <Button
            android:id="@+id/btn4"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="4"
            android:layout_weight="1"/>

        <Button
            android:id="@+id/btn5"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="5"
            android:layout_weight="1"/>

        <Button
            android:id="@+id/btn6"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="6"
            android:layout_weight="1"/>

        <Button
            android:id="@+id/btn7"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="7"
            android:layout_weight="1"/>

   </TableRow>