android计算器布局界面——基础编

计算器布局,是初学者学习的过程,下面让我们看看它的界面是如何的。

main.xml代码

 
 
  1. <?xml version="1.0" encoding="utf-8"?> 
  2. <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  3.     android:layout_width="fill_parent" 
  4.     android:layout_height="fill_parent" 
  5.     > 
  6.      
  7.     <TableRow> 
  8.     <Button  
  9.     android:layout_width="wrap_content" 
  10.     android:layout_height="wrap_content" 
  11.     android:text="  7  "/> 
  12.      
  13.      
  14.      <Button  
  15.     android:layout_width="wrap_content" 
  16.     android:layout_height="wrap_content" 
  17.     android:text="  8  "/> 
  18.      <Button  
  19.     android:layout_width="wrap_content" 
  20.     android:layout_height="wrap_content" 
  21.     android:text="  9  "/> 
  22.      <Button  
  23.     android:layout_width="wrap_content" 
  24.     android:layout_height="wrap_content" 
  25.     android:text="  /  "/> 
  26.      
  27.     </TableRow> 
  28.         <TableRow> 
  29.     <Button  
  30.     android:layout_width="wrap_content" 
  31.     android:layout_height="wrap_content" 
  32.     android:text="  4  "/> 
  33.      
  34.      
  35.      <Button  
  36.     android:layout_width="wrap_content" 
  37.     android:layout_height="wrap_content" 
  38.     android:text="  5  "/> 
  39.      <Button  
  40.     android:layout_width="wrap_content" 
  41.     android:layout_height="wrap_content" 
  42.     android:text="  6  "/> 
  43.      <Button  
  44.     android:layout_width="wrap_content" 
  45.     android:layout_height="wrap_content" 
  46.     android:text="  *  "/> 
  47.      
  48.     </TableRow> 
  49.         <TableRow> 
  50.     <Button  
  51.     android:layout_width="wrap_content" 
  52.     android:layout_height="wrap_content" 
  53.     android:text="  1  "/> 
  54.      
  55.     <Button  
  56.     android:layout_width="wrap_content" 
  57.     android:layout_height="wrap_content" 
  58.     android:text="  2  "/> 
  59.      <Button  
  60.     android:layout_width="wrap_content" 
  61.     android:layout_height="wrap_content" 
  62.     android:text="  3  "/> 
  63.      <Button  
  64.     android:layout_width="wrap_content" 
  65.     android:layout_height="wrap_content" 
  66.     android:text="  . "/> 
  67.       
  68.     </TableRow> 
  69.         <TableRow> 
  70.     
  71.      
  72.      
  73.      <Button  
  74.     android:layout_width="wrap_content" 
  75.     android:layout_height="wrap_content" 
  76.     android:text="  0  "/> 
  77.      <Button  
  78.     android:layout_width="wrap_content" 
  79.     android:layout_height="wrap_content" 
  80.     android:text="  =  "/> 
  81.      <Button  
  82.     android:layout_width="wrap_content" 
  83.     android:layout_height="wrap_content" 
  84.     android:text="  -  "/> 
  85.      
  86.      <Button  
  87.     android:layout_width="wrap_content" 
  88.     android:layout_height="wrap_content" 
  89.     android:text="  +  "/> 
  90.      
  91.     </TableRow> 
  92. <TextView   
  93.     android:layout_width="fill_parent"  
  94.     android:layout_height="wrap_content"  
  95.     android:text="@string/hello" 
  96.     /> 
  97. </TableLayout> 

 


本文转自 llb988 51CTO博客,原文链接:http://blog.51cto.com/llb988/491627,如需转载请自行联系原作者

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值