Implementation of Android Calculator interface

Source: Internet
Author: User



650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/49/05/wKioL1QNWdiCmyBgAACVakpkwX4529.jpg "title=" Calculator. jpg "alt=" wkiol1qnwdicmybgaacvakpkwx4529.jpg "/>



Activity_main.xml



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


<TableLayout>


<textview

Android:id= "@+id/text1"

Android:layout_width= "320DP"

android:layout_height= "60DP"

Android:textsize= "40sp"/>

</TableLayout>


<TableLayout>


<textview

Android:id= "@+id/text2"

Android:layout_width= "320DP"

android:layout_height= "60DP"

Android:textsize= "40sp"/>

</TableLayout>


<TableRow>


<button

Android:id= "@+id/button_clear"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/clear"

Android:textsize= "20sp"/>


<button

Android:id= "@+id/button_chu"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/chu"

Android:textsize= "20sp"/>


<button

Android:id= "@+id/button_cheng"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/cheng"

Android:textsize= "20sp"/>


<button

Android:id= "@+id/button_tui"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/tui"

Android:textsize= "20sp"/>

</TableRow>


<TableRow>


<button

Android:id= "@+id/button_qi"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/qi"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_ba"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/ba"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_jiu"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/jiu"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_jian"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/jian"

Android:textsize= "30sp"/>

</TableRow>


<TableRow>


<button

Android:id= "@+id/button_si"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/si"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_wu"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/wu"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_liu"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/liu"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_jia"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/jia"

Android:textsize= "30sp"/>

</TableRow>


<TableRow>


<button

Android:id= "@+id/button_yi"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/yi"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_er"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/er"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_san"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/san"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_dian"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/dian"

Android:textsize= "30sp"/>

</TableRow>


<TableRow>


<button

Android:id= "@+id/button_ling"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/ling"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_kuohao_r"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/kuohao_r"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_kuohao_l"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/kuohao_l"

Android:textsize= "30sp"/>


<button

Android:id= "@+id/button_deng"

Android:layout_width= "80DP"

android:layout_height= "70DP"

android:text= "@string/deng"

Android:textsize= "30sp"/>

</TableRow>


</TableLayout>



string Resource String.xml


<?xml version= "1.0" encoding= "Utf-8"?>

<resources>


<string name= "App_name" >Calculator</string>

<string name= "Action_settings" >Settings</string>

<string name= "Hello_world" >hello world!</string>

<string name= "Clear" >Clear</string>

<string name= "Chu" >/</string>

<string name= "Cheng" >*</string>

<string name= "Tui" >Back</string>

<string name= "Qi" >7</string>

<string name= "ba" >8</string>

<string name= "JIU" >9</string>

<string name= "Jian" >-</string>

<string name= "Si" >4</string>

<string name= "WU" >5</string>

<string name= "Liu" >6</string>

<string name= "Jia" >+</string>

<string name= "Yi" >1</string>

<string name= "ER" >2</string>

<string name= "San" >3</string>

<string name= "Dian" >.</string>

<string name= "Ling" >0</string>

<string name= "kuohao_l" >) </string>

<string name= "Kuohao_r" > (</string>

<string name= "Deng" >=</string>


</resources>




Implementation of the Android calculator interface

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.