zoukankan      html  css  js  c++  java
  • Android学习笔记——TableLayout

    该工程的功能是实现在一个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>
  • 相关阅读:
    把office文档转换为html过程中的一些坑
    JAVA运行时问题诊断-工具应用篇
    转:IT公司的十大内耗,别说你公司没有!
    安装storm的一些很乱的笔记
    航伴项目介绍
    centos7防火墙操作
    MySQL 截取字符串
    redis客户端介绍及php客户端的下载安装
    vscode 连接远程服务器 sftp
    redis主从复制
  • 原文地址:https://www.cnblogs.com/tonglin0325/p/4584150.html
Copyright © 2011-2022 走看看