移动应用开发实验一Android studio设计三种计算器的UI

使用必要的布局方式,设计下面三种计算器的界面:

简单的计算器

科学计算器

程序计算器

简单的计算器

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="0"
        android:gravity="end"
        android:layout_column="0"
        android:textSize="50sp"
        android:background="@drawable/shape"/>
    <TableRow>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="退格"
            android:layout_column="0"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="2dp"
            android:layout_marginBottom="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="清除"
            android:layout_column="1"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="2dp"
            android:layout_marginRight="2dp"
            android:layout_marginBottom="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="±"
            android:layout_column="2"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="2dp"
            android:layout_marginRight="2dp"
            android:layout_marginBottom="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="+"
            android:layout_column="3"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="2dp"
            android:layout_marginRight="2dp"
            android:layout_marginBottom="2dp"/>
    </TableRow>
    <TableRow>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="7"
            android:layout_column="0"
            android:layout_marginTop="2dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="2dp"
            android:layout_marginBottom="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="8"
            android:layout_column="1"
            android:layout_margin="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="9"
            android:layout_column="2"
            android:layout_margin="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="-"
            android:layout_column="3"
            android:layout_margin="2dp"/>
    </TableRow>
    <TableRow>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="4"
            android:layout_column="0"
            android:layout_marginTop="2dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="2dp"
            android:layout_marginBottom="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="5"
            android:layout_column="1"
            android:layout_margin="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="6"
            android:layout_column="2"
            android:layout_margin="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="*"
            android:layout_column="3"
            android:layout_margin="2dp"/>
    </TableRow>
    <TableRow>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="1"
            android:layout_column="0"
            android:layout_marginTop="2dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="2dp"
            android:layout_marginBottom="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="2"
            android:layout_column="1"
            android:layout_margin="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="3"
            android:layout_column="2"
            android:layout_margin="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="/"
            android:layout_column="3"
            android:layout_margin="2dp"/>
    </TableRow>
    <TableRow>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="0"
            android:layout_column="0"
            android:layout_marginTop="2dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="2dp"
            android:layout_marginBottom="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="."
            android:layout_column="1"
            android:layout_margin="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="1/X"
            android:layout_column="2"
            android:layout_margin="2dp"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="="
            android:layout_column="3"
            android:layout_margin="2dp"/>
    </TableRow>





</TableLayout>

科学计算器

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="0"
        android:gravity="end"
        android:layout_column="0"
        android:textSize="50sp"
        android:background="@drawable/shape"/>
    <TextView/>
    <RadioGroup
        android:orientation="horizontal"
        android:background="@drawable/shape">
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="角度"/>
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="弧度"/>
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="梯度"/>
    </RadioGroup>
    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/shape">
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="SIN"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="COS"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="TAN"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="COT"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ASIN"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ACOS"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ATAN"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ACOT"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="SINH"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="COSH"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="TANH"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="COTH"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ASINH"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ACOSH"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ATANH"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="ACOTH"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="LN"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="LOG10"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="N!"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="X^Y"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="E^X"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="0dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="π"
                android:layout_column="1"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="0dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="("
                android:layout_column="2"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="0dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text=")"
                android:layout_column="3"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="0dp"/>
        </TableRow>
    </TableLayout>
    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/shape">
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="退格"
                android:layout_column="0"
                android:layout_marginTop="0dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="清除"
                android:layout_column="1"
                android:layout_marginTop="0dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="±"
                android:layout_column="2"
                android:layout_marginTop="0dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="+"
                android:layout_column="3"
                android:layout_marginTop="0dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="7"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="8"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="9"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="-"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="4"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="5"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="6"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="*"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="1"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="2"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="3"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="/"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="."
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="1/X"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="="
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
    </TableLayout>
</TableLayout>

程序计算器

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="0"
        android:gravity="end"
        android:layout_column="0"
        android:textSize="50sp"
        android:background="@drawable/shape"/>
    <TextView/>
    <RadioGroup
        android:orientation="horizontal"
        android:background="@drawable/shape">
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="十六进制"
            android:layout_weight="1"
            android:textSize="10sp"/>
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="十进制"
            android:layout_weight="1"
            android:textSize="10sp"/>
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="八进制"
            android:layout_weight="1"
            android:textSize="10sp"/>
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="二进制"
            android:layout_weight="1"
            android:textSize="10sp"/>
    </RadioGroup>
    <RadioGroup
        android:orientation="horizontal"
        android:background="@drawable/shape">
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="八字节"
            android:layout_weight="1"
            android:textSize="10sp"/>
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="四字节"
            android:layout_weight="1"
            android:textSize="10sp"/>
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="二字节"
            android:layout_weight="1"
            android:textSize="10sp"/>
        <RadioButton
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="单字节"
            android:layout_weight="1"
            android:textSize="10sp"/>
    </RadioGroup>
    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/shape">
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="NOT"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"
                android:layout_weight="1"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="AND"
                android:layout_column="1"
                android:layout_margin="2dp"
                android:layout_weight="1"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="OR"
                android:layout_column="2"
                android:layout_margin="2dp"
                android:layout_weight="1"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="XOR"
                android:layout_column="3"
                android:layout_margin="2dp"
                android:layout_weight="1"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="循环左移"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"
                android:layout_weight="1"/>
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="循环右移"
                android:layout_column="1"
                android:layout_margin="2dp"
                android:layout_weight="1"/>
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="左移"
                android:layout_column="2"
                android:layout_margin="2dp"
                android:layout_weight="1"/>
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="MOD"
                android:layout_column="3"
                android:layout_margin="2dp"
                android:layout_weight="1"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="无符号右移"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"
                android:layout_weight="1"/>
            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="有符号右移"
                android:layout_column="1"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="10dp"
                android:layout_marginBottom="2dp"
                android:layout_weight="1"/>
        </TableRow>
    </TableLayout>
    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/shape">
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="退格"
                android:layout_column="0"
                android:layout_marginTop="0dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="清除"
                android:layout_column="1"
                android:layout_marginTop="0dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_column="2"
                android:layout_marginLeft="2dp"
                android:layout_marginTop="0dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"
                android:text="9" />
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="±"
                android:layout_column="3"
                android:layout_marginTop="0dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="6"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="7"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="8"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="+"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="3"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="4"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="5"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="-"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="0"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="1"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="2"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="*"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="A"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="B"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="C"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="/"
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
        <TableRow>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="D"
                android:layout_column="0"
                android:layout_marginTop="2dp"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="E"
                android:layout_column="1"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="F"
                android:layout_column="2"
                android:layout_margin="2dp"/>
            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="="
                android:layout_column="3"
                android:layout_margin="2dp"/>
        </TableRow>
    </TableLayout>
</TableLayout>

边框

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <stroke android:width="2px" android:color="#000000"/>
    <corners
        android:bottomLeftRadius="10px"
        android:bottomRightRadius="10px"
        android:topLeftRadius="10px"
        android:topRightRadius="10px"/>
    <padding
        android:bottom="3dp"
        android:left="3dp"
        android:right="3dp"
        android:top="3dp"/>
</shape>

边框的设置是建立一个drawable的xml文件,然后写了边框宽度、颜色、圆角和内边距。调用的时候用到了background属性

仅供参考 本人盒带21届小趴菜 切勿直接复制 查重难办QAQ

猜你喜欢

转载自blog.csdn.net/qq_64628470/article/details/129165758
今日推荐