Android Calculator maker 1. Layout

Source: Internet
Author: User
Tags border color

1.activity_main.xml File Layout

<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "Android: paddingleft= "@dimen/activity_horizontal_margin" android:paddingright= "@dimen/activity_horizontal_margin" Android :p addingtop= "@dimen/activity_vertical_margin" android:orientation= "vertical" android:paddingbottom= "@dimen/ Activity_vertical_margin "tools:context=". Mainactivity "><edittext android:layout_width=" fill_parent "android:layout_height=" 90DP "android:gravity=" ri        Ght|center_vertical "android:id=" @+id/edit_text1 "android:background=" @drawable/white_bg "/> <LinearLayout        android:layout_margintop= "10DP" android:orientation= "vertical" android:layout_width= "fill_parent" android:layout_height= "Fill_parent" > <linearlayout android:layout_weight= "1" Android  : Layout_width= "Fill_parent"          android:layout_height= "0DP" android:id= "@+id/ll1" android:orientation= "Horizontal"                > <button android:layout_weight= "1" android:layout_width= "0DP"                android:layout_height= "Fill_parent" android:text= "C" android:textsize= "30SP"                Android:id= "@+id/bt_clear"/> <button android:layout_weight= "1"                 Android:layout_width= "0DP" android:layout_height= "fill_parent" android:text= "DEL"                 Android:textsize= "30SP" android:id= "@+id/bt_del"/> <button android:layout_weight= "1" android:layout_width= "0DP" android:layout_height= " Fill_parent "android:text=" ÷ "android:textsize=" 30sp "android:id=" @+id/bt_div IDE "/> <button android:layout_weight= "1" android:layout_width= "0DP" android:layou t_height= "Fill_parent" android:text= "x" android:textsize= "30SP" android:id= "@ +id/bt_multipy "/> </LinearLayout> <linearlayout android:layout_weight             = "1" android:layout_width= "fill_parent" android:layout_height= "0DP" android:id= "@+id/ll2" android:orientation= "Horizontal" > <button android:layout_weight= "1 "Android:layout_width=" 0DP "android:layout_height=" Fill_parent "Android:text = "7" android:textsize= "30SP" android:id= "@+id/bt_7"/> <butt On android:layout_weight= "1" android:layout_width= "0DP" android:layout_height = "Fill_pareNT "android:text=" 8 "android:textsize=" 30SP "android:id=" @+id/bt_8 "                /> <button android:layout_weight= "1" android:layout_width= "0DP"                android:layout_height= "Fill_parent" android:text= "9" android:textsize= "30SP"                Android:id= "@+id/bt_9"/> <button android:layout_weight= "1"                Android:layout_width= "0DP" android:layout_height= "fill_parent" android:text= "-" Android:textsize= "30SP" android:id= "@+id/bt_minuse"/> </linearlay            Out> <linearlayout android:layout_weight= "1" android:layout_width= "Fill_parent" android:layout_height= "0DP" android:id= "@+id/ll3" android:layout_below= "@id/ll2" Android Oid:orientation= "HorizonTal "> <button android:layout_weight=" 1 "android:layout_width=" 0 DP "android:layout_height=" Fill_parent "android:text=" 4 "android:textsize=" 30 SP "android:id=" @+id/bt_4 "/> <button android:layout_weight= "1" android:layout_width= "0DP" android:layout_height= "Fill_parent" Android:te xt= "5" android:textsize= "30SP" android:id= "@+id/bt_5"/> <bu Tton android:layout_weight= "1" android:layout_width= "0DP" Android:layout_heig ht= "Fill_parent" android:text= "6" android:textsize= "30SP" android:id= "@+id/bt _6 "/> <button android:layout_weight=" 1 "Android:layout_widt H= "0DP" android:layout_height= "Fill_parent" android:text= "+" android:textsize= "30SP" a Ndroid:id= "@+id/bt_plus"/> </LinearLayout> <linearlayout Android:layo ut_weight= "2" android:layout_width= "Fill_parent" android:layout_height= "0DP" > <line Arlayout android:orientation= "Vertical" android:layout_weight= "3" Android:lay Out_width= "0DP" android:layout_height= "Fill_parent" > <linearlayout android:                layout_weight= "1" android:layout_width= "fill_parent" android:layout_height= "0DP" >                    <button android:layout_weight= "1" android:id= "@+id/btn_1"                    android:text= "1" android:textsize= "30sp" android:layout_width= "0DP" Android:layout_height= "Fill_parent"/> <button android:layout_weight= "1" Android : id= "@+id/btn_2" android:text= "2" android:textsize= "30sp" Android                    : layout_width= "0DP" android:layout_height= "fill_parent"/> <button                    android:layout_weight= "1" android:id= "@+id/btn_3" android:text= "3" Android:textsize= "30SP" android:layout_width= "0DP" android:layout_height= "fill                _parent "/> </LinearLayout> <linearlayout android:layout_weight=" 1 "                    Android:layout_width= "Fill_parent" android:layout_height= "0DP" > <button                    android:layout_weight= "2" android:id= "@+id/btn_0" android:text= "0" Android: textsize= "30sp" android:layout_width= "0DP" android:layout_height= "Fill_parent"/&gt                ;                    <button android:layout_weight= "1" android:id= "@+id/btn_point"                    Android:text= "." Android:textsize= "30SP" android:layout_width= "0DP" android:layout_height= "Fill_paren T "/> </LinearLayout> </LinearLayout> <linearlayout android                oid:layout_weight= "1" android:layout_width= "0DP" android:layout_height= "Fill_parent" > <button android:layout_width= "fill_parent" android:layout_height= "fil L_parent "android:text=" = "android:id=" @+id/btn_dengyu "android:t Extsize= "30sp"/> </LinearLayout> </linearlaYout> </LinearLayout></LinearLayout> 

  

2.mainfest.xml settings

<activity    android:theme= "@android: Style/theme.black.notitlebar"/>//Theme Black no title

The writing of 3.color.xml

<?xml version= "1.0" encoding= "Utf-8"?><resources> <color name=    "White" > #ffffff </color>    <color name= "Black" > #000000 </color></resources>

4.drawable Create White_bg.xml as EditText white background

<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" >    <corners android:radius= "5DP"/>//Corner radius 5DP fillet    <solid//Fill color        android:color= "@co Lor/white "        /> </shape>

  

①<corners/>: Sets the fillet. Android:radius= "5DP": The fillet radius is 5DP.
②<gradient/>: Gradient of Image color. Start color: startcolor= "@color/white". End color: endcolor= "@color/red"
③<stroke/>: Border. Width= "1DP": Border width. Color= "@color/black": Border color.
④<solid/>: Fill Color. Color= "@color/white": The fill color is white.

Android Calculator maker 1. Layout

Related Article

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.