Android计算器布局测试

胸怀万里世界, 放眼无限未来。这篇文章主要讲述Android计算器布局测试相关的知识,希望能为你提供帮助。
1  TableLayout(表格布局) 
http://www.cnblogs.com/zhaoyucong/p/6101353.html
http://www.cnblogs.com/UUUP/p/3983309.html
【Android计算器布局测试】

Android计算器布局测试

文章图片

Android计算器布局测试

文章图片
Android计算器布局测试

文章图片
1 < ?xml version="1.0" encoding="utf-8"?> 2 < TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 3android:layout_width="match_parent" 4android:stretchColumns="*" 5android:layout_height="match_parent" > 6 7< TextView 8android:layout_weight="1" 9android:id="@+id/TextView1" 10android:layout_width="wrap_content" 11android:layout_height="60dp" 12android:gravity="right|center_vertical" 13android:textSize="30sp" 14android:text="90" 15/> 16 17< TableRow 18android:id="@+id/tableRow1" 19android:layout_weight="1" 20android:layout_width="wrap_content" 21android:layout_height="match_parent" > 22 23< Button 24android:id="@+id/button1" 25android:layout_width="wrap_content" 26android:layout_height="match_parent" 27android:textSize="25sp" 28android:text="7" /> 29 30< Button 31android:id="@+id/button2" 32android:layout_width="wrap_content" 33android:textSize="25sp" 34android:layout_height="match_parent" 35android:text="8" /> 36 37< Button 38android:id="@+id/button3" 39android:layout_width="wrap_content" 40android:textSize="25sp" 41android:layout_height="match_parent" 42android:text="9" /> 43 44< Button 45android:id="@+id/button4" 46android:layout_width="wrap_content" 47android:layout_height="match_parent" 48android:textSize="25sp" 49android:text="/" /> 50 51< /TableRow> 52 53< TableRow 54android:id="@+id/tableRow2" 55android:layout_weight="1" 56android:layout_width="wrap_content" 57android:layout_height="match_parent" > 58 59< Button 60android:id="@+id/button5" 61android:textSize="25sp" 62android:layout_width="wrap_content" 63android:layout_height="match_parent" 64android:text="4" /> 65 66< Button 67android:id="@+id/button6" 68android:textSize="25sp" 69android:layout_width="wrap_content" 70android:layout_height="match_parent" 71android:text="5" /> 72 73< Button 74android:id="@+id/button7" 75android:textSize="25sp" 76android:layout_width="wrap_content" 77android:layout_height="match_parent" 78android:text="6" /> 79 80< Button 81android:id="@+id/button8" 82android:textSize="25sp" 83android:layout_width="wrap_content" 84android:layout_height="match_parent" 85android:text="*" /> 86 87< /TableRow> 88 89< TableRow 90android:id="@+id/tableRow3" 91android:layout_weight="1" 92android:layout_width="wrap_content" 93android:layout_height="match_parent" > 94 95< Button 96android:id="@+id/button9" 97android:textSize="25sp" 98android:layout_width="wrap_content" 99android:layout_height="match_parent" 100android:text="1" /> 101 102< Button 103android:id="@+id/button10" 104android:textSize="25sp" 105android:layout_width="wrap_content" 106android:layout_height="match_parent" 107android:text="2" /> 108 109< Button 110android:textSize="25sp" 111android:id="@+id/button11" 112android:layout_width="wrap_content" 113android:layout_height="match_parent" 114android:text="3" /> 115 116< Button 117android:id="@+id/button12" 118android:textSize="25sp" 119android:layout_width="wrap_content" 120android:layout_height="match_parent" 121android:text="-" /> 122 123< /TableRow> 124 125< TableRow 126android:id="@+id/tableRow4" 127android:layout_weight="1" 128android:layout_width="wrap_content" 129android:layout_height="match_parent" > 130 131< Button 132android:id="@+id/button13" 133android:layout_width="wrap_content" 134android:layout_height="match_parent" 135android:textSize="25sp" 136android:text="0" /> 137 138< Button 139android:id="@+id/button14" 140android:layout_width="wrap_content" 141android:textSize="25sp" 142android:layout_height="match_parent" 143android:text="." /> 144 145< Button 146android:id="@+id/button15" 147android:textSize="25sp" 148android:layout_width="wrap_content" 149android:layout_height="match_parent" 150android:text="+" /> 151 152< Button 153android:id="@+id/button16" 154android:textSize="25sp" 155android:layout_width="wrap_content" 156android:layout_height="match_parent" 157android:text="=" /> 158 159< /TableRow> 160 161< TableRow 162android:id="@+id/tableRow5" 163android:layout_weight="1" 164android:layout_width="wrap_content" 165android:layout_height="match_parent" > 166 167< Button 168android:id="@+id/button17" 169android:layout_span="4" 170android:textSize="25sp" 171android:layout_width="wrap_content" 172android:layout_height="match_parent" 173android:text="clear" /> 174 175< /TableRow> 176 177 < /TableLayout>

View Code2. 线性布局  http://blog.csdn.net/goodluckac/article/details/51954380
Android计算器布局测试

文章图片

Android计算器布局测试

文章图片
Android计算器布局测试

文章图片
1 < ?xml version="1.0" encoding="utf-8"?> 2 < LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3android:layout_width="match_parent" 4android:orientation="vertical" 5android:layout_height="match_parent"> 6< LinearLayout 7android:layout_width="match_parent" 8android:layout_weight="1" 9android:layout_height="wrap_content"> 10< TextView 11android:layout_width="match_parent" 12android:layout_height="wrap_content" 13android:text="99999999" 14android:textSize="35dp"/> 15 16< /LinearLayout> 17< LinearLayout 18android:layout_width="match_parent" 19android:layout_weight="6" 20android:layout_height="wrap_content" 21android:orientation="vertical"> 22< LinearLayout 23android:layout_width="match_parent" 24android:layout_height="wrap_content" 25android:layout_weight="4" 26android:orientation="vertical"> 27< LinearLayout 28android:layout_width="match_parent" 29android:layout_height="0dp" 30android:layout_weight="1"> 31< Button 32android:layout_width="wrap_content" 33android:layout_height="match_parent" 34android:layout_weight="1" 35android:text="mc" /> 36< Button 37android:layout_width="wrap_content" 38android:layout_height="match_parent" 39android:layout_weight="1" 40android:text="m+" /> 41< Button 42android:layout_width="wrap_content" 43android:layout_height="match_parent" 44android:layout_weight="1" 45android:text="m-" /> 46< Button 47android:layout_width="wrap_content" 48android:layout_height="match_parent" 49android:layout_weight="1" 50android:text="mr" /> 51< /LinearLayout> 52< LinearLayout 53android:layout_width="match_parent" 54android:layout_height="0dp" 55android:layout_weight="1"> 56< Button 57android:layout_width="wrap_content" 58android:layout_height="match_parent" 59android:layout_weight="1" 60android:text="c" /> 61< Button 62android:layout_width="wrap_content" 63android:layout_height="match_parent" 64android:layout_weight="1" 65android:text="+/-" /> 66< Button 67android:layout_width="wrap_content" 68android:layout_height="match_parent" 69android:layout_weight="1" 70android:text="/" /> 71< Button 72android:layout_width="wrap_content" 73android:layout_height="match_parent" 74android:layout_weight="1" 75android:text="*" /> 76< /LinearLayout> 77< LinearLayout 78android:layout_width="match_parent" 79android:layout_height="0dp" 80android:layout_weight="1"> 81< Button 82android:layout_width="wrap_content" 83android:layout_height="match_parent" 84android:layout_weight="1" 85android:text="7" /> 86< Button 87android:layout_width="wrap_content" 88android:layout_height="match_parent" 89android:layout_weight="1" 90android:text="8" /> 91< Button 92android:layout_width="wrap_content" 93android:layout_height="match_parent" 94android:layout_weight="1" 95android:text="9" /> 96< Button 97android:layout_width="wrap_content" 98android:layout_height="match_parent" 99android:layout_weight="1" 100android:text="-" /> 101 102< /LinearLayout> 103< LinearLayout 104android:layout_width="match_parent" 105android:layout_height="0dp" 106android:layout_weight="1"> 107< Button 108android:layout_width="wrap_content" 109android:layout_height="match_parent" 110android:layout_weight="1" 111android:text="41" /> 112< Button 113android:layout_width="wrap_content" 114android:layout_height="match_parent" 115android:layout_weight="1" 116android:text="5" /> 117< Button 118android:layout_width="wrap_content" 119android:layout_height="match_parent" 120android:layout_weight="1" 121android:text="6" /> 122< Button 123android:layout_width="wrap_content" 124android:layout_height="match_parent" 125android:layout_weight="1" 126android:text="+" /> 127 128< /LinearLayout> 129 130< /LinearLayout> 131< LinearLayout 132android:layout_width="match_parent" 133android:layout_height="0dp" 134android:layout_weight="2" 135android:orientation="horizontal"> 136< LinearLayout 137android:layout_width="0dp" 138android:layout_height="match_parent" 139android:layout_weight="3" 140android:orientation="vertical"> 141< LinearLayout 142android:layout_width="match_parent" 143android:layout_height="0dp" 144android:layout_weight="1"> 145< Button 146android:layout_width="wrap_content" 147android:layout_height="match_parent" 148android:layout_weight="1" 149android:text="1" /> 150< Button 151android:layout_width="wrap_content" 152android:layout_height="match_parent" 153android:layout_weight="1" 154android:text="2" /> 155< Button 156android:layout_width="wrap_content" 157android:layout_height="match_parent" 158android:layout_weight="1" 159android:text="3" /> 160< /LinearLayout> 161< LinearLayout 162android:layout_width="match_parent" 163android:layout_height="0dp" 164android:layout_weight="1"> 165< Button 166android:layout_width="wrap_content" 167android:layout_height="match_parent" 168android:layout_weight="1" 169

    推荐阅读