呵呵,其实很简单

就是将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. Preemption Context Switches 和 Synchronization Context Switches

    Preemption Context Switches测量操作系统任务调度线程处理器上执行的次数,以及切换到较高-priority螺纹,数. Synchronization context switc ...

  2. Eclipse Maven构建Spring MVC项目

    工作中项目开发使用Maven管理项目的构建.打包.编译,框架採用的是Spring MVC框架,而且实现了多模块.多项目的管理.自己也简单的參与了架构的设计.对于刚開始学习的人来说,使用Maven构建项 ...

  3. Android Context MODE的四种模式解析(转)

    Context.MODE_PRIVATE:为默认操作模式,代表该文件是私有数据,只能被应用本身访问,在该模式下,写入的内容会覆盖原文件的内容,如果想把新写入的内容追加到原文件中.可以使用Context ...

  4. 军医王-moTestin云测试看好移动医疗行业

    看医生汪谟军:Testin云測在移动医疗产业大有可为 2014/10/21 · Testin · 开发人员訪谈 日常生活可能常常碰到这种情况:突然遇上头疼脑热.小病小痛,去医院又不方便:非常想了解家人 ...

  5. NYOJ353 3D dungeon 【BFS】

    3D dungeon 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描写叙述 You are trapped in a 3D dungeon and need to find ...

  6. 采购申请 POCIRM-001:ORA-01403: 无论数据未找到

    今天就让同事帮忙看问题.当请求生成采购订单,在销售模块错误提交销售订单 查看请求日志 +-------------------------------------------------------- ...

  7. HDU 1877 另一个版本 A+B

    另一个版本 A+B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  8. (转).net webconfig使用IConfigurationSectionHandler自定section

    自定义配置结构 (使用IConfigurationSectionHandler) 假设有以下的配置信息,其在MyInfo可以重复许多次,那么应如何读取配置呢?这时就要使用自定义的配置程序了.<m ...

  9. Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

    1.错误叙述性说明 2014-7-12 0:38:57 org.apache.catalina.core.ApplicationContext log 信息: No Spring WebApplica ...

  10. hdu Diophantus of Alexandria(素数的筛选+分解)

    Description Diophantus of Alexandria was an egypt mathematician living in Alexandria. He was one of ...