Giter Club home page Giter Club logo

calculator-android-miui's Introduction

仿MIUI计算器

基本功能:

1,完成了基本的加减乘除运算。
2,表达式出错(例如除以0)会返回错误。
3,点击等号后会有运算小动画(视图动画)。
4,点击等号运算结束后,再点击运算符和数字会有不同的效果,即点击运算符会把上一次的结果当做第一个数参与运算,而点击数字会清空重新输入。

5,完成科学计算界面
6,完成简易计算器与科学计算器之间的动画变换。
7,待完善科学计算的计算程序........囧,还没写完	

重点:

  • 键盘界面仿的小米计算器,使用TableLayout,由于TableLayout不支持合并行,因而采用了嵌套的方式来显示跨行的等号。
  • 最上面的表达式和结果显示的两个EditText使用右对齐,注意在每次输入的时候都要setSelection,即:text2.setSelection(expression.length());来确保始终会显示最新输入的字符。
  • 为了使简易计算器和科学计算器之间变换效果接近小米原来的效果,这里使用了FrameLayout,键盘在第一层,占据下面2/3的用户区域,其他在第二层占据上面1/3的用户区域。这样,在键盘进行缩放动画的时候就不会影响到第二层的显示。(键盘的动画始终显示在下面2/3的范围内!!!!

另外,注意三种高度的不同:

  • 屏幕区域,高度为整个屏幕的高度
  • 应用区域,高度为去除状态栏的屏幕的高度
  • 用户区域,高度为去除状态栏和标题栏的高度

simple

simple2

simple2

simple2

calculator-android-miui's People

Contributors

ginsmile avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.