该工程的功能是实现在一个activity中显示一个表格

以下代码是MainActivity.java中的代码

package com.example.tablelayout;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem; public class MainActivity extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

以下的代码是activity_main.xml中的代码

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/TableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
tools:context="${relativePackage}.${activityClass}" > <!-- 由于fill_parent不能填满,所以stretchColumns指定列拉伸 --> <TableRow>
<TextView
android:text="@string/hello_world"
android:padding="3dip"
android:background="#aa0000" />
<TextView
android:text="@string/hello_world"
android:padding="3dip"
android:background="#00aa00"
android:gravity="center_horizontal" />
<TextView
android:text="@string/hello_world"
android:padding="3dip"
android:background="#0000aa"
android:gravity="right" /> </TableRow> <TableRow>
<TextView
android:text="@string/hello_world"
android:padding="3dip" /> <TextView
android:text="@string/hello_world"
android:padding="3dip"
android:gravity="right" /> </TableRow> </TableLayout>

Android学习笔记——TableLayout的更多相关文章

  1. 【转】Pro Android学习笔记(二五):用户界面和控制(13):LinearLayout和TableLayout

    目录(?)[-] 布局Layout 线性布局LinearLayout 表格布局TableLayout 布局Layout Layout是容器,用于对所包含的view进行布局.layout是view的子类 ...

  2. Android 学习笔记之Volley(七)实现Json数据加载和解析...

    学习内容: 1.使用Volley实现异步加载Json数据...   Volley的第二大请求就是通过发送请求异步实现Json数据信息的加载,加载Json数据有两种方式,一种是通过获取Json对象,然后 ...

  3. Android学习笔记进阶之在图片上涂鸦(能清屏)

    Android学习笔记进阶之在图片上涂鸦(能清屏) 2013-11-19 10:52 117人阅读 评论(0) 收藏 举报 HandWritingActivity.java package xiaos ...

  4. android学习笔记36——使用原始XML文件

    XML文件 android中使用XML文件,需要开发者手动创建res/xml文件夹. 实例如下: book.xml==> <?xml version="1.0" enc ...

  5. Android学习笔记之JSON数据解析

    转载:Android学习笔记44:JSON数据解析 JSON(JavaScript Object Notation)是一种轻量级的数据交换格式,采用完全独立于语言的文本格式,为Web应用开发提供了一种 ...

  6. udacity android 学习笔记: lesson 4 part b

    udacity android 学习笔记: lesson 4 part b 作者:干货店打杂的 /titer1 /Archimedes 出处:https://code.csdn.net/titer1 ...

  7. Android学习笔记36:使用SQLite方式存储数据

    在Android中一共提供了5种数据存储方式,分别为: (1)Files:通过FileInputStream和FileOutputStream对文件进行操作.具体使用方法可以参阅博文<Andro ...

  8. Android学习笔记之Activity详解

    1 理解Activity Activity就是一个包含应用程序界面的窗口,是Android四大组件之一.一个应用程序可以包含零个或多个Activity.一个Activity的生命周期是指从屏幕上显示那 ...

  9. Pro Android学习笔记 ActionBar(1):Home图标区

     Pro Android学习笔记(四八):ActionBar(1):Home图标区 2013年03月10日 ⁄ 综合 ⁄ 共 3256字 ⁄ 字号 小 中 大 ⁄ 评论关闭 ActionBar在A ...

随机推荐

  1. MyEclipse下Maven的安装配置

    Maven常用命令: •mvn archetype:generate :创建 Maven 项目 •mvn compile :编译源代码 •mvn test-compile :编译测试代码 •mvn t ...

  2. idea 新建web项目

  3. 【CodeVS 1993】草地排水 isap模板题

    开始网络流的学习,更新一下isap的模板 #include<cstdio> #include<cstring> #include<algorithm> #defin ...

  4. 概率 light oj 1104

    t个数据 n天一年  至少2个人在同一天生日的概率>=0.5 问至少多少人 显然要从反面考虑 设365天 都在不同一天的概率 p(num)=1*364/365*363/365...; =(day ...

  5. 51nod 1013快速幂 + 费马小定理

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1013 这是一个等比数列,所以先用求和公式,然后和3^(n+1)有关,有n ...

  6. URI 中特殊字符处理

    一.问题阐述 今天写 url 请求时,不管是get 请求还是 post 请求,如果参数中带有 + % # 等特殊符号,就无法正常获得参数 具体现象就是 用URL传参数的时候,用&符号连接,如果 ...

  7. mindmup-editabletable-编辑table的使用

    官方网站:http://mindmup.github.io/editable-table/ github下载地址:https://github.com/mindmup/editable-table 我 ...

  8. java-汉字转化拼音(纯java)

    1.转换所有的拼音 import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Set; public cl ...

  9. hibernate在使用sql查询query自动转化成model类型数据,query.addEntity

    hibernate使用自动的hql查询或者其封装的查询方法都能字段转化成对象 而如果在hibernate中使用sql时大多返回为Object[]对象 那么如何将object[]转换成model呢,答案 ...

  10. lift and throw

    import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { ...