Android.view.InflateException: Binary XML file line #7: Error inflating class button错误的解决方法

刚开始接触android开发,今天尝试重现网上一个webview的小例子,码完代码后,运行程序时出现如下错误:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.webview/com.example.webview.WebViewActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class button

工程中的布局文件mainactivity.xml如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    
    <button
        android:id="@+id/Button01"
        android:layout_width="96dp"
        android:layout_height="64dp"
        android:onClick="onClick"
        android:text="@string/Go" />

        <EditText
        android:id="@+id/EditText01"
        android:layout_width="fill_parent"
        android:layout_height="80dp"
        android:inputType="text"
        android:singleLine="true" />
        
    <WebView
        android:id="@+id/WebView01"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</LinearLayout>

网上查资料发现,这类错误一般是xml布局文件中的标签或者属性的命名有问题,最后查找发现是自己的button标签名未大写导致的错误将button标签名改正后,程序就可以正常运行了!总结:1.在写xml的相关属性/标签时,要注意拼写的准确性(大小写),一致性(控件名要正确)2.注意代码的格式,标签要匹配

参考文章:http://www.cnblogs.com/pinky878/archive/2012/05/17/2506341.html

其他相关错误:http://stackoverflow.com/questions/14565460/error-opening-supportmapfragment-for-second-time

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值