Android - Layout时发生'Unfortunately xxx has stopped'
概述
我在进行LinearLayout和TableLayout的嵌套布局的时候,发生题的错误.如下布局xml代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="horizontal" > <TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#996699"
android:gravity="center"
android:text="one" /> <TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#FFFF99"
android:gravity="center"
android:text="two" /> <TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#CC9966"
android:gravity="center"
android:text="three" /> <TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#CCCC99"
android:gravity="center"
android:text="four" />
</LinearLayout> <LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical" > <TableLayout> <TableRow> <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#993333"
android:gravity="center"
android:text="five" /> <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#CCCCCC"
android:gravity="center"
android:text="six" />
</TableRow> <TableRow> <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#FFFF99"
android:gravity="center"
android:text="seven" />
</TableRow>
</TableLayout>
</LinearLayout> </LinearLayout>
其中,应该在第51行中,TableLayout加上'layout_width'和'layout_height'属性.即可.如下(第46/47行):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="horizontal" > <TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#996699"
android:gravity="center"
android:text="one" /> <TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#FFFF99"
android:gravity="center"
android:text="two" /> <TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#CC9966"
android:gravity="center"
android:text="three" /> <TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#CCCC99"
android:gravity="center"
android:text="four" />
</LinearLayout> <LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical" > <TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" > <TableRow> <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#993333"
android:gravity="center"
android:text="five" /> <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#CCCCCC"
android:gravity="center"
android:text="six" />
</TableRow> <TableRow> <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#FFFF99"
android:gravity="center"
android:text="seven" />
</TableRow>
</TableLayout>
</LinearLayout> </LinearLayout>
Android - Layout时发生'Unfortunately xxx has stopped'的更多相关文章
- sqlserver插入时发生在“xxx”处关键发生错误
今天知道了一个小技巧,当你的数据库表名为user时会sqlserver的表发生冲突,所以因该将user这样用[user],ok 一切搞定 .
- .net安装部署“Error 1001 在初始化安装时发生异常” 的解决方法
状况描述:打包安装后,如果删除安装目录中的某个文件,这时从桌面快捷方式启动软件系统会自动运行修复程序,此时因为路径问题会报出“错误 1001 在初始化安装时发生异常xxx”的异常.(前提是你的安装部署 ...
- Android之“Unfortunately,xxx has stopped!”
初学Android遇到Unfortunately,xxx has stopped!真是一件让人头疼的事情,下面就遇到的两种可能情况给出解决方案.通常遇到的情况在于由一个Activity跳转至另一个Ac ...
- Eclipse新建Android工程,在模拟器运行的时候提示Unfortunately,XXX has stopped.
刚新建好的android工程在模拟器运行的时候出错,提示Unfortunately,XXX has stopped 查看Eclipse下面的错误信息,双击第一条 把ActionBarActivity前 ...
- 解决WCF“接收对 http://xxx.svc 的 HTTP 响应时发生错误。这可能是由于服务终结点绑定未使用 HTTP 协议造成的。这还可能是由于服务器中止了 HTTP 请求上下文(可能由于服务关闭)所致"
最近在工作中新加了一个接口,本地调试的时候,直接抛出“接收对 http://xxx.svc 的 HTTP 响应时发生错误.这可能是由于服务终结点绑定未使用 HTTP 协议造成的.这还可能是由于服务器中 ...
- Android运行时注入浅析与使用
背景 最近接触新项目,项目中引入了Android Annotation(AA)依赖注入开源框架,代码中大片的注解代码,对于没用过注解框架(或者说没有如此大面积的使用)的我来说确实看得很费力,于是花时间 ...
- Android编译报Errors running builder 'Android Pre Compiler' on project 'XXX' java.lang.NullPointerException
编译android时,遇到报错:Errors occurred during the build.Errors running builder 'Android Pre Compiler' on pr ...
- 0xC0000005: 读取位置 0x00000000 时发生访问冲突
遇见这种问题一般都是空指针,即:指针里没有赋值~ 如果你对null 进行操作就会产生空指针异常 Object obj = new Object(); 你要知道 obj是一个Object指针变量,指向O ...
- android layout文件优化
性能优化1--UI优化 1.使用系统为我们提供了几个抽象的标签①include:重用include中layout属性指定一个外部布局文件,通过该方式则不需要把这个布局文件在该代码中重复的写一遍了. 若 ...
随机推荐
- 登录远程SQL服务器
一 看ping 服务器IP能否ping通. 这个实际上是看和远程sql server 2000服务器的物理连接是否存在.如果不行,请检查网络,查看配置,当然得确保远程sql server 2000服务 ...
- [BZOJ 1816] [Cqoi2010] 扑克牌 【二分答案】
题目链接:BZOJ - 1816 题目分析 答案具有可以二分的性质,所以可以二分答案. 验证一个答案 x 是否可行,就累加一下各种牌相对于 x 还缺少的量,如果总和超过了 x 或 m ,就不可行. 因 ...
- 汇编cmp比较指令详解
刚刚看到了cmp指令,一开始有点晕.后来上网找了些资料,终于看明白了,为了方便初学者,我就简单写下我的思路吧.高手绕过,谢谢! cmp(compare)指令进行比较两个操作数的大小 例:cmp opr ...
- FindControl什么时候才会使用ObjectFromHWnd函数呢?——VCL很难调试,加一个日志函数,记录时间
IsDelphiHandleFindVCLWindowfunction IsVCLControl(Handle: HWND): Boolean;function FindControl(Handle: ...
- maven jetty
父项目: <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons- ...
- mysql安装2
linux下安装mysql-5.1.51.tar.gz (2010-10-27 10:59:26) 转载▼ 标签: mysql 数据库 tar.gz安装 杂谈 分类: Mysql数据库 MySQL h ...
- 【HDOJ】3419 The Three Groups
记忆化搜索. /* 3419 */ #include <cstdio> #include <cstring> #include <cstdlib> #define ...
- 网络流(最大密集度子图,分数规划):UvaLive 3709 Hard Life
John is a Chief Executive Officer at a privately owned medium size company. The owner of the company ...
- 数据结构(动态树):[国家集训队2012]tree(伍一鸣)
[问题描述] 一棵n个点的树,每个点的初始权值为1.对于这棵树有q个操作,每个操作为以下四种操作之一: + u v c:将u到v的路径上的点的权值都加上自然数c: - u1 v1 u2 v2:将树中原 ...
- Clouds
1.Eucalyptus: Eucalyptus is a Linux-based software architecture that implements scalable private and ...