呵呵,其实很简单

就是将TableLayout定义一种颜色,在给TableRow定义一种颜色。通过TableRow的layout_margin挤出一个像素的宽度就变成了TableLayout的宽度。这种方法好不好,我也不知道,就是自己经常用,如果有更好的方案,希望提供。

<?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"
android:background="#ffffff"> <TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#939093" > <ImageButton
android:id="@+id/weather_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0.5dip"
android:layout_marginRight="0.5dip"
android:background="@drawable/index_btn"
android:src="@drawable/t5" /> <ImageButton
android:id="@+id/contact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0.5dip"
android:layout_marginRight="0.5dip"
android:background="@drawable/index_btn"
android:src="@drawable/jsq2" /> <ImageButton
android:id="@+id/notepad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0.5dip"
android:layout_marginRight="0.5dip"
android:background="@drawable/index_btn"
android:src="@drawable/js6" />
</TableRow> <TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#939093" > <ImageButton
android:id="@+id/calculator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0.5dip"
android:layout_marginRight="0.5dip"
android:background="@drawable/index_btn"
android:src="@drawable/j5" /> <ImageButton
android:id="@+id/ems_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0.5dip"
android:layout_marginRight="0.5dip"
android:background="@drawable/index_btn"
android:src="@drawable/k3" /> <ImageButton
android:id="@+id/calendar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0.5dip"
android:layout_marginRight="0.5dip"
android:background="@drawable/index_btn"
android:src="@drawable/r2" />
</TableRow> </TableLayout>

如何给TableLayout加边框的更多相关文章

  1. Html-浅谈如何正确给table加边框

    一般来说,给表格加边框都会出现不同的问题,以下是给表格加边框后展现比较好的方式 <style> table,table tr th, table tr td { border:1px so ...

  2. 多行图片hover加边框兼容IE7+

    问题: 遇到多行多列排列的图片时,hover上去加边框会把下面的图片挤到别处 ============================================================ ...

  3. div加边框

    一.虚线与实线边框 边框虚线样式:dashed 边框实现样式:solid border:1px dashed #000 代表设置对象边框宽度为1px黑色虚线边框 border:1px solid #0 ...

  4. CSS鼠标悬停图片加边框效果,不位移的方法

    <!DOCTYPE HTML> <html lang="en-US"> <head> <title>css实现鼠标悬停时图片加边框效 ...

  5. AS3给显示对象加边框

    给显示对象加边框,可以有以下三种方法1.根据相交路径的缠绕规则的奇偶规则法(使用奇偶缠绕规则时,任何相交路径都交替使用开放填充与闭合填充.如果使用同一填充绘制的两个正方形相交,则不会填充相交的区域.通 ...

  6. DDGScreenShot--iOS 图片裁剪,切圆角,加边框,你还用cornerRadius,还有更高级的用法

    写在前面 我们肯定做过这样的需求,给一个图片切圆角, 当然我们大多采用简单粗暴的方法 myIcon.layer.cornerRadius = 16.5 myIcon.layer.masksToBoun ...

  7. C#实现给图片加边框的方法

    Bitmap bit= new Bitmap(@"" + Path);//给图片加边框 //Bitmap bit = new Bitmap(Screen.AllScreens[0] ...

  8. 浅谈如何正确给table加边框

    一般来说,给表格加边框都会出现不同的问题,以下是给表格加边框后展现比较好的方式 <style> table,table tr th, table tr td { border:1px so ...

  9. 用CSS给表格加边框

    很久之前,给表格加边框用的方法是给表格加上背景色,然后把cellspacing="1",再给td设置成另一种颜色,这样间接的加边框颜色. 一直没去细研究,今天发现了一种很简单的加边 ...

随机推荐

  1. jQuery.reveal弹出层使用

    最近用到弹出层,还得自定义UI,原本用的artDialog太庞大,不合适了,于是就找到了这个东西,又小又好用,基础的弹出遮罩都有了,想要什么还不是Coder自己说了算. 这个插件是基于Jquery实现 ...

  2. Javascript标准类型的方法集

    1 array.concat(item...) concat方法会产生一个新数组,将一个或多个item附加在数组之后 var a = ['a', 'b', 'c'] var b = ['x', 'y' ...

  3. CodeForces 28D Don&#39;t fear, DravDe is kind dp

    主题链接:点击打开链接 为了让球队后,删除是合法的.也就是说,对于每一个车辆, l+r+c 一样,按l+r+c分类. 然后dp一下. #include <cstdio> #include ...

  4. HDU 1754 I Hate It (段树 &amp; 树阵)

    I Hate It Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...

  5. JavaScript学习之获取URL参数

    最近看了几道面试题,其中有一道就是关于写一个方法来获取浏览器地址栏URL查询部分的字段内容.虽然之前看过相关的东西,但感觉有点模糊,所以就又全面的学习一遍,谨以此文记之! 准备知识 在JavaScri ...

  6. [ACM] hdu 1285 确定比赛 (拓扑排序)

    确定比赛 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submi ...

  7. Android批量图片加载经典系列——使用二级缓存、异步网络负载形象

    一.问题描写叙述 Android应用中常常涉及从网络中载入大量图片,为提升载入速度和效率,降低网络流量都会採用二级缓存和异步载入机制.所谓二级缓存就是通过先从内存中获取.再从文件里获取,最后才会訪问网 ...

  8. JBoss7官方最新版下载地址

    JBoss是全世界开发人员共同努力的成果,一个基于J2EE的开放源码的应用server. 由于JBoss代码遵循LGPL许可,能够在不论什么商业应用中免费使用它,而不用支付费用.2006年,Jboss ...

  9. 《代码的第一行——Android》封面诞生

    <代码的第一行--Android>已经上市近一个月,现在的情况是相当不错的销售,也特别感谢众多朋友的支持. 其实一本好书,假设你想卖.除了给予外力所要求的内容.封面设计是至关重要的,这本书 ...

  10. NYoj The partial sum problem(简单深搜+优化)

    题目链接:http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=927 代码: #include <stdio.h> #include & ...