移动开发技术(实验二)——利用线性布局实现UI界面设计

#实验二
简单的使用线性布局实现一个计算机UI界面的作业,任何功能,后面抽时间把计算器的功能实现。
在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="1">
    <EditText
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_margin="10dp"
        />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:orientation="horizontal">

        <Button
            android:text="MC"
            android:layout_width="67dp"
            android:layout_height="76dp" />

        <Button
            android:text="MR"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />

        <Button
            android:text="MS"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />
        <Button
            android:text="M+"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />
        <Button
            android:text="M-"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />

    </LinearLayout>
    <LinearLayout

        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:orientation="horizontal">

        <Button
            android:text="delete"
            android:layout_width="67dp"
            android:layout_height="76dp"
            />

        <Button
            android:text="CE"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />

        <Button
            android:text="C"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />
        <Button
            android:text="+-"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />
        <Button
            android:text="genghao"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />

    </LinearLayout>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:orientation="horizontal">

        <Button
            android:text="7"
            android:layout_width="67dp"
            android:layout_height="76dp" />

        <Button
            android:text="8"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />

        <Button
            android:text="9"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />
        <Button
            android:text="/"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />
        <Button
            android:text="%"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />

    </LinearLayout>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:orientation="horizontal">

        <Button
            android:text="4"
            android:id="@+id/button"
            android:layout_width="67dp"
            android:layout_height="76dp" />

        <Button
            android:text="5"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />

        <Button
            android:text="6"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />
        <Button
            android:text="*"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />
        <Button
            android:text="1/x"
            android:layout_width="67dp"
            android:layout_height="76dp"
            android:layout_marginLeft="10dp" />

    </LinearLayout>



    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:orientation="horizontal">
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_marginLeft="0dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"

                android:orientation="horizontal">

                <Button
                    android:text="1"
                    android:layout_width="67dp"
                    android:layout_height="76dp" />

                <Button
                    android:text="2"
                    android:layout_width="67dp"
                    android:layout_height="76dp"
                    android:layout_marginLeft="10dp" />

                <Button
                    android:text="3"
                    android:layout_width="67dp"
                    android:layout_height="76dp"
                    android:layout_marginLeft="10dp" />
                <Button
                    android:text="-"
                    android:layout_width="67dp"
                    android:layout_height="76dp"
                    android:layout_marginLeft="10dp" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">


                <Button
                    android:text="0"
                    android:layout_width="144dp"
                    android:layout_height="76dp"
                    />

                <Button
                    android:text="."
                    android:layout_width="67dp"
                    android:layout_height="76dp"
                    android:layout_marginLeft="10dp" />
                <Button
                    android:text="+"
                    android:layout_width="67dp"
                    android:layout_height="76dp"
                    android:layout_marginLeft="10dp" />

            </LinearLayout>

        </LinearLayout>
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <Button
                android:layout_marginLeft="10dp"
                android:text="="
                android:layout_width="67dp"
                android:layout_height="152dp" />
        </LinearLayout>
    </LinearLayout>



</LinearLayout>

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="1">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:gravity="center"

            android:layout_marginTop="50dp">
            <EditText
                android:hint = "请输入账号"
                android:layout_width="300dp"
                android:inputType="number"
                android:layout_height="wrap_content" />
            <EditText
                android:hint = "请输入你的密码"
                android:layout_width="300dp"
                android:inputType="textPassword"
                android:layout_height="wrap_content" />
            <Button
                android:layout_marginTop="10dp"
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:text="登录"
                android:textColor="#ffffff"
                android:background="@color/colorPrimary"/>
            <Button
                android:layout_marginTop="10dp"
                android:layout_width="200dp"
                android:layout_height="wrap_content"
                android:text="注册"
                android:textColor="#ffffff"
                android:background="@color/colorPrimary"/>
            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="忘记密码?" />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="忘记密码?"
                    android:layout_marginLeft="50dp"/>
            </LinearLayout>
        </LinearLayout>
        
    </LinearLayout>




</LinearLayout>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值