Android实现给TableLayou绘制边框的方法
作者:yhm2046 发布时间:2021-08-04 02:08:41
标签:Android,TableLayou
本文实例讲述了Android实现给TableLayou绘制边框的方法。分享给大家供大家参考,具体如下:
效果如下:
思路:使用share作为背景显示边框
步骤:
1.在res/drawable文件夹下建立table_frame_gray.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#ffffff" />
<stroke
android:width="0.01dp"
android:color="#848484" />
</shape>
2.在布局文件里引用table_frame_gray.xml文件作为背景:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFF00"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FF4000"
android:stretchColumns="*"
android:text="@string/hello_world" >
<!-- 微博数 -->
<TableRow>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/table_frame_gray"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="232" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="微博" />
</LinearLayout>
<!-- 关注人数 -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/table_frame_gray"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="38" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="关注" />
</LinearLayout>
<!-- 好友数 -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/table_frame_gray"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="9" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="粉丝" />
</LinearLayout>
</TableRow>
</TableLayout>
</RelativeLayout>
希望本文所述对大家Android程序设计有所帮助。
0
投稿
猜你喜欢
- 这些属性都是可外部配置且可动态替换的,既可以在典型的 Java 属性文件中配置,亦可通过 properties 元素的子元素来传递。例如:&
- 这篇文章主要介绍了Springboot2.0处理自定义异常并返回json,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考
- 目录背景统一接口返回定义API返回码枚举类定义正常响应的API统一返回体定义异常响应的API统一返回体编写包装返回结果的自定义注解定义返回结
- 之前有学弟问过我一道java的面试题,题目不算难。用java实现杨辉三角。我花了点时间整理了一下,发现挺有意思的,于是想写下来分享一下。在写
- 引言在 java8 中,您可以使用 Arrays.Stream 或 Stream.of 将 Array 转换为 Stream。1. 对象数组
- JSON.toJSONString()空字段不忽略修改使用JSON.toJSONString(object)方法,返回的json中,默认会将
- 很久没写文章了,一方面是最近几个月比较忙,没太多时间,另一方面是最近拖延症严重,写文章的想法总是一拖再拖。今天找一个小案例写一下,与懒惰对抗
- Java异常层次结构Exception异常RuntimeException与非RuntimeException异常的区别:非RuntimeE
- 一、项目简述本系统主要实现的功能有: 学生以及老师的注册登录,在线考试,错题查询,学生管理,问题管理,错题管理,错题查询,分数查询,试卷管
- JDBC Statement对象实例以下是利用以下三种查询以及打开和关闭说明的例子:boolean execute(String SQL)
- 去年就已经学了这个技术了,一直没去写,现在抽个时间写了个俄罗斯方块游戏。只有简单的新游戏,暂停,继续,积分功能。简单的实现了俄罗斯的经典功能
- 目录MotionEventViewViewGroup事件拦截寻找目标视图,分发ACTION_DOWN分发除ACTION_DOWN外的其他事件
- 一、登录认证基于过滤器链Spring Security的登录验证流程核心就是过滤器链。当一个请求到达时按照过滤器链的顺序依次进行处理,通过所
- 多表联合查询resultType的返回值一般数据按参数类型返回<select id="queryCarIdList"
- 一、概述在上一篇的叙述中,我们通过图层的方式完成了图片颜色的填充(详情请戳:Android不规则图像填充颜色小游戏),不过在着色游戏中更多的
- 一.模拟问题最近在公司遇到一个问题,挂号系统是做的集群,比如启动了两个相同的服务,病人挂号的时候可能会出现同号的情况,比如两个病人挂出来的号
- spring data jpa @query返回map踩坑记录最近用spring data jpa,网上看的一些教程,有的说是返回的Obje
- public interface ICacheStrategy { &
- 本文实例讲述了C#实现图像锐化的方法。分享给大家供大家参考。具体如下://定义图像锐化函数private static Bitmap Sha
- volatile这个关键字可能很多朋友都听说过,或许也都用过。在Java 5之前,它是一个备受争议的关键字,因为在程序中使用它往往会导致出人