安卓 计算器页面

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

    <EditText android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="right|bottom"/>

    <TableRow>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="mc"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="m+"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="m-"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="mr"/>
    </TableRow>
    <TableRow>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="AC"
            android:textColor="#00F"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="←"
            android:textColor="#00F"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="+/-"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="÷"/>
    </TableRow>
    <TableRow>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="7"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="8"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="9"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="x"/>
    </TableRow>
    <TableRow>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="4"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="5"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="6"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="-"/>
    </TableRow>
    <TableRow>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="1"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="2"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="3"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="+"/>
    </TableRow>
    <TableRow>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="2"
            android:text="0"/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="."/>
        <Button android:layout_width="0pt"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="="/>
    </TableRow>

</TableLayout>

时间: 2024-10-14 08:31:43

安卓 计算器页面的相关文章

(转)安卓基本页面布局

布局: 在 android 中我们常用的布局方式有这么几种: 1.LinearLayout ( 线性布局 ) :(里面只可以有一个控件,并且不能设计这个控件的位置,控件会放到左上角) 线性布局分为水平线性和垂直线性二者的属性分别为: android:orientation= "horizontal android:orientation= "vertical" . 2.RelativeLayout ( 相对布局 ) : (里面可以放多个控件,但是一行只"   能放一

简易计算器页面

Calculator.jsp: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":&qu

android开发-安卓计算器

第一次弄安卓开发,有点坎坷,不过还好,经过两天的努力还是能完成. 首先在res/layout的文件夹下配置activity_main.xml文件 这是一个安卓页面文件,有关界面的控件都是在这里定义,例如在里面写一段内容: <TableRow> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height=

Android 安卓实现页面相互跳转并相互传递参数

一.对于两个页面之间相互传值,跳转的时候我们使用 startActivityForResult(intent,0),而不是startActivity(intent) 这个方法 第一个页面中在触发跳转的按钮中写上 Intent intent=new Intent(MainActivity.this,SecondActivity.class); //将text框中的值传入 intent.putExtra("name",text.getText().toString()); //为了接受Se

安卓之页面跳转与传值和按钮事件

一:新建页面 即新建Activity,new-other-Android Activity,next, 新建Activity的时候, 1:eclipse会自动创建Layout,我们发现Layout目录下会多了对应的xml文件: 2:ec会自动在AndroidManifest.xml中创建对应的activity节点: 需要注意的是,这些都是ec帮我们自动创建的,我们完全可以手动创建 class,然后让它继承自activity,然后指定layout的那个xml,然后手动创建节点完成. 二:点击按钮进

安卓登录页面的布局

首先呢先让大家看一下整个登录页面 下面我依次讲解页面制作的步骤: 一.这个页面分为两个部分 1.背景 2.登录页面 二.整体的布局 这个页面所用的事嵌套布局,在线性布局里面嵌套的是相对布局,在大多数情况下,还是推荐用线性布局. 下面咱们先实现第一部分的代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"

安卓计算器

MainActivity部分:package com.hanqi.textapp2; import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.TextView; public class MainActivity extends AppCompatActiv

.Net程序员快速学习安卓开发-布局和点击事件的写法

关注今日头条-做全栈攻城狮,学代码也要读书,爱全栈,更爱生活.提供程序员技术及生活指导干货. 本系列课程 致力于老手程序员可以快速入门学习安卓开发.系统全面的从一个.Net程序员的角度一步步学习总结安卓开发. 上篇课程:全栈工程师必备:安卓移动端手机开发,第六课 主要内容: 布局 点击事件 布局 说到安卓前台页面的开发,就不得不说安卓的布局.也就是具体那个控件应该摆放的位置. 1.1相对布局 我们新建一个layout布局文件时,默认就是相对布局.相对布局是相对于非相对布局来说的.顾名思义,相对布

做一个php登陆页面,用pc登陆和用手机登陆弹出来的登陆页面不一样。

<?phpheader('Content-Type:text/html; charset=UTF-8');//定义页面编码为utf8$is_pc = (strpos($agent, 'windows nt')) ? true : false;//是否是pc电脑端$is_mobi = (strpos($agent, 'Mobile')) ? true : false;//是否是移动端$is_iphone = (strpos($agent, 'iphone')) ? true : false; //