呵呵,其实很简单

就是将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. Cordic 算法的原理介绍

    cordic 算法知道正弦和余弦值,求反正切,即角度. 采用用不断的旋转求出对应的正弦余弦值,是一种近似求解发. 旋转的角度很讲求,每次旋转的角度必须使得 正切值近似等于 1/(2^N).旋转的目的是 ...

  2. JAVA深入研究——Method的Invoke方法(转)

    在写代码的时候,发现Method可以调用子类的对象,但子类即使是改写了的Method,方法名一样,去调用父类的对象也会报错,虽然这是很符合多态的现象,也符合java的动态绑定规范,但还是想弄懂java ...

  3. Eclipse 4.4.2 取消空格键代码上屏

    基本是照这个站点来的: 点击打开链接 可是问题不止这些!! 从网上下了SDK, 然后打开之后首先发现没有plugins窗体, 好吧, 先通过Help -> Install New Softwar ...

  4. [TroubleShooting] The remote copy of database xx has not been rolled forward to a point in time

    Steps: 1. backup database TestMirror on Pricipal server 2. backup database log of TestMirror on Pric ...

  5. 模拟linux下的ls -l命令

    #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h&g ...

  6. Composer常见问题

    Composer常见问题 原文链接:Composer常见问题 安装了Composer后,运行composer --version,查看Composer的版本号.如果出现下面的提示,那么软件安装成功. ...

  7. 全排列 ( next_permutation)

    SLT: C++的STL有一个函数可以方便地生成全排列,这就是next_permutation 在C++ Reference中查看了一下next_permutation的函数声明: #include ...

  8. kobject_create_and_add

    本文来源于源linux 3.14.3版本号/lib/kobject.c文件 /**  * kobject_create_and_add - 动态地创建kobject结构和寄存器sysfs  *  * ...

  9. Android两个注意事项.深入了解Intent和IntentFilter(两)

    深入理解Intent和IntentFiler(二) 转载请表明出处:http://blog.csdn.net/u012637501(嵌入式_小J的天空)     在上一篇文章中,我们比較具体学习了&q ...

  10. Log4j2 简明教程

    一.概述 log4j2官方文档内容非常多,要一次性了解全部是不可能的.正确的步骤应当是先了解最常见的配置,当发现原有知识无法解决问题,再重新查看文档看有没有合适的配置.下面将从文件结构入手,再到简单的 ...