tabhost切换标签:Log中出现You must supply a layout_width attribute的解决方法
谷歌、百度该问题,发现,除非是真的忘记添加layout_height或者layout_width属性值,对于布局文件没有语法问题但又难以发现问题所在的情况,从自己的经历和一个帖子的说明看到,该错误多半是由于忘记在XML中添加某个属性的长度值。
我遇到的情况,在布局中有如下的长度引用:
android:layout_marginTop ="@dimen/dial_number_bn_top"
但是并没有在对应dpi文件夹的dimens.xml中定义该属性值,因此出错。另外,缺少一些图片资源可能也会引起该错误。
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
http://blog.sina.com.cn/s/blog_76721b120101ai5j.html
另:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="right"
android:orientation="vertical"
android:visibility="visible" > <LinearLayout
android:layout_width="310dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:animateLayoutChanges="false"
android:orientation="vertical" > <LinearLayout
android:id="@+id/LinearLayout_dz"
android:layout_width="match_parent"
android:layout_height="37dp"
android:orientation="horizontal"
android:visibility="visible" > <TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=""
android:text="TextView" /> </LinearLayout>
</LinearLayout> </LinearLayout>
今天在编辑android布局文件时,后台提示以下错误:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pubproject/com.example.pubproject.MainActivity}: java.lang.RuntimeException: Binary XML
file line #23: You must supply a layout_width attribute.
经反复试验:原因是TextView只要缺少 android:layout_width="wrap_content" 这一句,就会报错。具体原因待查中。
tabhost切换标签:Log中出现You must supply a layout_width attribute的解决方法的更多相关文章
- Android Error:You must supply a layout_width attribute……
出现这种情况的可能原因目前本人碰到的有: 1:在xml文件中某个属性名或者属性值写错,请务必仔细检查你有没有写错某个拼写. 2:当你在,比如TextView中,没有声明layout_width,经测试 ...
- You must supply a layout_width attribute的错误原因及解决办法
学习android的过程中,尝试新功能,结果出现了这个一个error: 05-21 15:38:52.745: E/AndroidRuntime(17608): java.lang.RuntimeEx ...
- python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?
python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...
- 关于真机调试DDMS中的data文件夹打不开的解决方法
关于真机调试DDMS中的data文件夹打不开的解决方法 今天在开发的时候需要导出程序中的数据库文件查看数据,数据库文件默认就在/data/data/应用包名/databases/数据库名 这个路径下, ...
- Node.js中针对中文的查找和替换无效的解决方法
Node.js中针对中文的查找和替换无效的解决方法. //tags的值: tag,测试,帖子 var pos1 = tags.indexOf("测"); //这里返回-1 ta ...
- SecureCRT中某些命令提示符下按Backspace显示^H的解决方法
SecureCRT中某些命令提示符下按Backspace显示^H的解决方法 安装了Apache Derby数据库服务器之后,使用ij客户端去连接derby服务端,可是在ij中输入命令的时候,每当输入错 ...
- C语言中关于POW在不同状态下四舍五入的解决方法
这是今天作业中的一个代码: #include <stdio.h>#include<math.h>int main(){ printf("请输入一个整数:") ...
- php中url传递中文字符,特殊危险字符的解决方法
php中的urldecode,base64_encode函数然后再结合自己写的替换函数来进行安全传递url中文字符,特殊危险字符. 需要在url中传递中文字符或是其它的html等特殊字符,似乎总会有各 ...
- MFC中cannot find the definition (implementation) of this function 解决方法
问题:使用vc6 在点击左侧class view中的一个方法实现时出现下面错误: cannot find the definition (implementation) of this func ...
随机推荐
- jquery的ajax向ashx传值,中文乱码问题
从网上查找了很多资料: 有在配置文件里面加如下配置 <globalization responseEncoding="utf-8" requestEncoding=" ...
- 2016-2017 CT S03E05: Codeforces Trainings Season 3 Episode 5 (2016 Stanford Local Programming Contest, Extended) B
链接:http://codeforces.com/gym/101116 学弟做的,以后再补 #include <iostream> #include <stdio.h> #in ...
- php redis(2)
[config_inc.php] <?php //APP的读账号 //$config['appServer']['servername'] = 'app.com'; $config['appSe ...
- 【Regular Expression】常用的正则表达式
一套完善的应用程序,需要能验证用户输入的信息,从而提醒/引导用户正确地输入信息. 而验证方面,以验证所在的地方分类,可分为: 客户端验证.如果是WEB,一般由Javascript完成,主要用户引导用户 ...
- 【MySQL】MySQL PLSQL Demo - 006.循环(WHILE DO and FOR LOOP)
WHILE DO drop procedure if exists p_while_do; create procedure p_while_do() begin declare i int; ; d ...
- UVA 11461 - Square Numbers
题目:统计区间中的平方数个数. 分析: ... #include <stdio.h> #include <string.h> ]; int main() { int i, a, ...
- SqlSever基础 dateadd year,增加五年
镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...
- Java1.8.0_05 环境配置
1.计算机->属性->高级系统设置->环境变量->系统变量 2.新建JAVA_HOME 变量值设为C:\Java\jdk1.8.0_05 即安装目录,确定. 3.新建CLASS ...
- Oracle的数据恢复——Flashback用法汇总
/* 11g的flashbackup 分好几种,分别用途不一样. A.flashback database 闪回数据库,简单理解就是把数据库闪回到某个以前的时间点, 能恢复到的最早的SCN, 取决与F ...
- 对MSP430单片机__delay_cycles精确延时的说明及改正
在这里, 我来讨论一下关于MSP430单片机使用__delay_cycles延时的问题. IAR for MSP430编译器提供了一个编译器内联的精确延时函数(并非真正的函数)以提供用户精确延时使用, ...