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程序设计有所帮助。


猜你喜欢
- 淘宝物流信息TimeLine的制作方法:仿照的TimeLine效果图: 代码实现:package com.zms.timelineview;
- 代码很简单,这里就不多废话了。package cc.c;import android.app.Activity;import android
- public/protected/privatepublic表示公开,private表示私有,protected表示保护,什么都不写表示默认
- 前言最近在研究串口通讯,其中有几个比较重要的概念,RS-232这种适配于上位机和PC端进行连接,RS-232只限于PC串口和设备间点对点的通
- 一、背景介绍在微服务都是以HTTP接口的形式暴露自身服务的,因此在调用远程服务时就必须使用HTTP客户端。我们可以使用JDK原生的URLCo
- 究其根本,原因在于,能在unity面板上识别的变量,public不是唯一的条件,另外一个条件是可序列化比如你声明了如下一个类using Sy
- 本文实例讲述了C#编程实现自定义热键的方法。分享给大家供大家参考。具体实现方法如下:using System;using System.Co
- 公司编辑妹子需要爬取网页内容,叫我帮忙做了一简单的爬取工具这是爬取网页内容,像是这对大家来说都是不难得,但是在这里有一些小改动,代码献上,大
- 最近遇到一个需求需要圆形listview作为悬浮窗,费了九牛二虎之力终于开发出来了,特别有成就感,下面分享下案例,项目原因,只能分享一部分供
- 前言WebView(网络视图)在Andorid中就是用来显示网页的,下面我们来一起看看它是如何使用的。一、基本使用1.声明权限,WebVie
- 先看看效果图:中间的圆形头像和光环波形讲解请看:https://www.jb51.net/article/96508.htm周围的气泡布局,
- 1.前言在Mybatis中需要创建的配置文件有sqlMapconfig.xml,映射文件xxxMapper.xml,而这些文件在idea中并
- 最近由于项目需求,项目中需要实现一个WebSSH连接终端的功能,由于自己第一次做这类型功能,所以首先上了GitHub找了找有没有现成的轮子可
- 最近一年的项目都是在使用Mybatis-plus,感觉挺好用的,也没遇到很多问题,但是在最近项目上线之后,遇到了一些新的需要,在进行新版本开
- 1. 新增XML文件XMLToolV2 _xmlHelper = new XMLToolV2(@"C:\20140311blogs
- 导读导读 | 12月总体来说互联网的技术圈是非常热闹的,chatGPT爆火,SpringBoot3.0发布等重磅陆消息续进入大家的视线,而本
- 本文实例讲述了基于私钥加密公钥解密的RSA算法C#实现方法,是一种应用十分广泛的算法。分享给大家供大家参考之用。具体方法如下:一、概述RSA
- 前面的文章介绍了如何进行权限控制,即访问控制器或者方法的时候,要求当前用户必须具备特定的权限,但是如何在程序中进行权限的分配呢?下面就介绍下
- 上篇文章中介绍了聊天功能,这里介绍通讯录是如何实现的。首先要加载公司的所有部门,树形结构,然后点击进入部门的人员列表,点击人员能查看详细信息
- 本文实例为大家分享了Android实现全局悬浮框的具体代码,供大家参考,具体内容如下效果图:代码实现:Androidmanifest.xml