<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <!-- 定义第一个表格布局,指定第2列允许收缩,第3列允许拉伸 --> <TableLayout
android:id="@+id/TableLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shrinkColumns="1"
android:stretchColumns="2" > <!-- 直接添加按钮,它自己会占一行 --> <Button
android:id="@+id/ok1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="独自一行的按钮" />
<!-- 添加一个表格行 --> <TableRow> <!-- 为该表格行添加3个按钮 --> <Button
android:id="@+id/ok2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="普通按钮" /> <Button
android:id="@+id/ok3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="收缩的按钮" /> <Button
android:id="@+id/ok4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="拉伸的按钮" />
</TableRow>
</TableLayout> </LinearLayout>

上述LinearLayout中只有一个TableLayout,在<TableLayout处有警告信息:This TableLayout layout or its LinearLayout parent is possibly useless

下面的LinearLayout中有两个TableLayout就没有这种警告信息:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <!-- 定义第一个表格布局,指定第2列允许收缩,第3列允许拉伸 --> <TableLayout
android:id="@+id/TableLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shrinkColumns="1"
android:stretchColumns="2" > <!-- 直接添加按钮,它自己会占一行 --> <Button
android:id="@+id/ok1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="独自一行的按钮" />
<!-- 添加一个表格行 --> <TableRow> <!-- 为该表格行添加3个按钮 --> <Button
android:id="@+id/ok2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="普通按钮" /> <Button
android:id="@+id/ok3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="收缩的按钮" /> <Button
android:id="@+id/ok4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="拉伸的按钮" />
</TableRow>
</TableLayout> <TableLayout
android:id="@+id/TableLayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:collapseColumns="1" > <!-- 直接添加按钮,它自己会占一行 --> <Button
android:id="@+id/ok5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 独自一行的按钮 " />
<!-- 定义一个表格行 --> <TableRow> <!-- 为该表格行添加3个按钮 --> <Button
android:id="@+id/ok6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="普通按钮1" /> <Button
android:id="@+id/ok7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="被隐藏的按钮" /> <Button
android:id="@+id/ok8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="普通按钮 3" />
</TableRow>
</TableLayout> </LinearLayout>

This TableLayout layout or its LinearLayout parent is possibly useless的更多相关文章

  1. Waring:This LinearLayout layout or its FrameLayout parent is useless; transfer the background attribute to the other view

    解决方法请参考: You have a single component (row) vertical linear layout, containing another linear layout. ...

  2. Android性能优化方法(八)

    Android SDK tools目录下提供一个观察布局的工具,层级观察器(Hierarchy Viewer).Hierarchy Viewer工具是一个非常好的布局优化工具,同时,你也可以通过它学习 ...

  3. 教你使用Android SDK布局优化工具layoutopt

    创建好看的Android布局是个不小的挑战,当你花了数小时调整好它们适应多种设备后,你通常不想再重新调整,但笨重的嵌套布局效率往往非常低下,幸运的是,在Android SDK中有一个工具可以帮助你优化 ...

  4. Android:一个高效的UI才是一个拉风的UI(二)

    趁今晚老大不在偷偷早下班,所以有时间继续跟大伙扯扯UI设计之痛,也算一个是对上篇<Android:一个高效的UI才是一个拉风的UI(一)>的完整补充吧.写得不好的话大家尽管拍砖~(来!砸死 ...

  5. 22、DDMS(转载)

    本文是转载,出处为http://www.xuebuyuan.com/1291595.html 如需删除本文,请私信我,谢谢 DDMS DDMS是一款Google* 提供的应用,可作为独立的工具运行,也 ...

  6. 利用Hierarchy Viewer优化布局

    好久没更新博客了,趁着清明来写点什么. 今天来讲下如何使用android中提供的工具优化我们的布局.首先我们写一个最简单的框架布局. <?xml version="1.0" ...

  7. 调试 Android* x86 应用程序的方法以及要使用的工具

    作者:Xiaodong Wang 1.简单介绍 众所周知,Android* 开发者头顶很多称呼:设计员.程序员等,而且一般会不可避免地被称为故障检修工. 代码中的错误无法避免.因此不管您是否一開始就造 ...

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

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

  9. 寒假学干货之------LinearLayout.layout.weight

    所有原始代码由这个大神写的--http://www.cnblogs.com/zhangs1986/archive/2013/01/17/2864237.html layout/activity_mai ...

随机推荐

  1. LA 5713 秦始皇修路 MST

    题目链接:http://vjudge.net/contest/144221#problem/A 题意: 秦朝有n个城市,需要修建一些道路使得任意两个城市之间都可以连通.道士徐福声称他可以用法术修路,不 ...

  2. 构建ceph deb 安装包

    前言:本文基于ubuntu 14.04.5 LTS 和ceph v0.94.3 之上做的实验 一.编译ceph包1.1.克隆ceph代码,切换分支 git clone --recursive http ...

  3. No module named 'urllib2'

    import urllib2 response = urllib2.urlopen('http://www.baidu.com/') html = response.read() print html ...

  4. spring mvc文件上传

    package com.haier.controller.newuser; import com.haier.commons.entity.Response; import com.haier.com ...

  5. 用Python生成组织机构代码,附源码

    #!/usr/bin/python import random def haoma(): ww = [3,7,9,10,5,8,4,2]#suan fa yin zi cc = [] dd=0 for ...

  6. XFire完整入门教程

    网上关于XFire入门的教程不少,要么是讲得很简单,就像Hello World一样的程序,要么就是通过IDE集成的工具来开发的,这对于不同的人群有诸多不便,关于XFire的一些详细的信息就不再多讲,可 ...

  7. 微信小程序-视图列表渲染

    wx:for 在组件上使用wx:for控制属性绑定一个数组,即可使用数组中各项的数据重复渲染该组件. 默认数组的当前项的下标变量名默认为index,数组当前项的变量名默认为item <view ...

  8. SQL数据库中字段类型 与C#中的对应字段类型

    数据库中的字段类型和对应的C#中的对应字段类型 数据库                 C#程序int int32text stringbigint int64binary System.Byte[] ...

  9. es6还欠完善的地方

    const的可变性 const用于声明常量. 什么是常量,声明后的值不可更改. 对于值类型,比如string,number等等.const声明确实有效. const str = "strin ...

  10. 转 unity 优化

    最近研究U3D开发,个人认为,精通一种新的技术,最快最好的方法就是看它的document,而且个人习惯不喜欢看中文的资料,原汁原味的东西是最正确的,一翻译过来很多东西就都不那么准确了.于是通读了uni ...