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

这篇具有很好参考价值的文章主要介绍了移动应用开发实验一Android studio设计三种计算器的UI。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

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

简单的计算器

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

科学计算器

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

程序计算器

移动应用开发实验一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>
移动应用开发实验一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="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>
移动应用开发实验一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"/>
    <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>
移动应用开发实验一Android studio设计三种计算器的UI

边框

<?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属性文章来源地址https://www.toymoban.com/news/detail-511211.html

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

到了这里,关于移动应用开发实验一Android studio设计三种计算器的UI的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 移动应用开发实验-内容提供者-ContentResolver的使用

    本人将所学和前人的成果和经验结合,仅供学习和参考!!! 本文大部分源码内容有清晰的注释,请认真阅读! 通过线性布局和相对布局来搭建通讯录界面,界面效果如下图所示。创建布局文件contact_item.xml、导入界面图片、放置界面控件、创建条目界面的背景文件。创建

    2024年02月08日
    浏览(41)
  • Android移动应用开发的学习路线

    Android移动应用开发的学习路线。以下是一个基本的学习路线,供你参考: 1. Java基础 学习Java的基本语法和面向对象编程(OOP)的概念 了解Java的数据类型、变量和常量 学习控制结构(如条件语句、循环语句)和函数 2. Android基础 了解Android平台的基本概念和架构 学习Android的

    2024年02月11日
    浏览(41)
  • Android应用开发(1)Android Studio开发环境搭建

    Android应用开发学习笔记——目录索引 本章介绍搭建Android Studio应用开发环境,创建并编译App工程,运行和调试App。 谷歌开发者网站可直接下载AndroidStudio,下载链接:https://developer.android.com/studio 点击【Download Android Studio Electric Eel】 勾选【I have read and agree with the above terms and

    2024年02月07日
    浏览(40)
  • 如何开发移动应用:iOS和Android的比较

    移动应用开发领域一直以来都备受关注,而iOS和Android作为两大主要的移动操作系统,各自拥有强大的生态系统和开发工具。在本文中,我们将比较iOS和Android移动应用开发的关键方面,以帮助开发者选择合适的平台,或者了解在不同平台上开发应用时需要考虑的因素。 iOS iO

    2024年02月07日
    浏览(42)
  • Flutter 开发者工具 Android Studio 开发Flutter应用

    Flutter 开发者工具 在 Android Studio 开发Flutter应用 🔥 Android Studio 版本更新 🔥 Android Studio Check for Update Connection failed ​ 解决方案 ​    ​  🔥 编辑代码,和查看问题 🔥  Dart 插件 可以做到如下几点 :  语法高亮显示。 基于多种类型分析的代码补全。 定位到类型的声明(

    2024年02月15日
    浏览(94)
  • 移动开发最佳实践:为 Android 和 iOS 构建成功应用的策略

    您可以将本文作为指南,确保您的应用程序符合可行的最重要标准。请注意,这份清单远非详尽无遗;您可以加以利用,并添加一些自己的见解。 要制作一个成功的应用程序,你需要了解你是为谁制作的。从创建用户角色开始–基于人口统计、行为模式、动机和目标,对理想

    2024年02月13日
    浏览(37)
  • Flutter与Android开发:构建跨平台移动应用的新选择

    本文内容提纲如下: 介绍Flutter技术:Flutter是一种由Google推出的开源UI工具包,用于构建高性能、跨平台的移动应用。文章将介绍Flutter的基本概念、特点和优势,包括其快速的开发速度、一致的用户界面和丰富的UI组件库等。 Flutter与Android开发的对比:文章将对比Flutter与传统

    2023年04月21日
    浏览(55)
  • Android应用开发入门:从Android Studio环境设置到Java编程基础

    目录 介绍 步骤一:设置Android Studio环境 步骤二:了解Android Studio界面

    2024年02月13日
    浏览(40)
  • 安卓移动应用开发课程设计(图书借阅系统)代码+使用流程介绍文档

    目录 第1章 概述 1 1.1 开发背景 1 1.2 开发目标 1 1.3 设计原则 1 第2章 需求分析 1 2.1 项目定义 2 2.2 需求陈述 2 2.3 不同角色用例 2 第3章 可行性分析 3 3.1 经济可行性分析 3 3.2 技术可行性分析 3 3.3 法律可行性分析 4 3.4 操作可行性分析 4 第4章 总体设计 4 4.1 设计思路 4 4.2 设计意义

    2024年02月06日
    浏览(53)
  • 毕业设计--智能环境监测系统基于harmonyOS的移动端应用开发

    目录 第一章 绪论 1.1 引言 1.2 智能环境监测APP概述 1.3 课题设计思路 第二章 项目开发环境 2.1 鸿蒙介绍 2.1.1 鸿蒙的发展史 2.1.2 鸿蒙应用开发的意义 2.1.3 HUAWEI DevEco Studio 介绍 2.1.4 HUAWEI DevEco Studio 环境安装 2.1.5 HarmonyOS系统技术架构 2.1.6 HUAWEI dececo studio 使用 2.1.7 Harmony编程语言

    2024年02月15日
    浏览(39)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包