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 ...
随机推荐
- eclipse alt+/ 无效时,如何设置 《转》
一般情况下alt+/有代码提示作用,还有代码提示的快捷代码也不是alt+/,因此要恢复代码提示用alt+/.需要做两件事. 在 Window - Preferences - General - Key ...
- Bootstrap——基本模板
<!DOCTYPE html><html lang="zh-cn"> <head> <meta charset="utf ...
- ContentProvider官方教程(3)ContentResolver查询、遍历 示例
Retrieving Data from the Provider This section describes how to retrieve data from a provider, using ...
- android Log 等级以及在Android Studio 的Logcat中过滤方法
Log等级 等级越高,问题越严重. Log.e(TAG,"级别5,错误信息"); Log.e(TAG,"级别5,错误信息"); Log.w(TAG," ...
- Python 2.7.9 Demo - 获取调用的参数
#coding=utf-8 #!/usr/bin/python import sys; print("The command line parameters are : "); f ...
- jquery post 报404错误
如果确定页面存在,那很可能是程序执行时报错,可改成get方式来确认一下.
- 我的android学习经历20
WebView的使用 WebView既可以和Intent一样实现界面跳转一样,让系统浏览器打开页面,也可以在应用程序中打开页面 注意用WebView时,需要注册网络服务 代码如下: package c ...
- jquery相对选择器,又叫context选择器,上下文选择器;find()与children()区别
jquery相对选择器有两个参数,jQuery函数的第二个参数可以指定DOM元素的搜索范围(即以第二个参数指定的内容为容器查找指定元素). 第二个参数的不同的类型,对应的用法如下表所示. 类型 用法 ...
- 利用MDK4中的逻辑分析仪分析IO口的PWM波
1.先设置软件仿真 ,可参看STM32不完全手册的2.4的软件仿真这一章 (原文件名:1.jpg) Example functionality: ...
- HDU 5831 Rikka with Parenthesis II(六花与括号II)
31 Rikka with Parenthesis II (六花与括号II) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536 ...