zoukankan      html  css  js  c++  java
  • Android代码没有错误,但是运行出错

    菜鸟经过了2个多小时的调整,重要发现了问题的所在:

    代码没有提出错误,运行的时候程序老是显示错误,提示的错误是:

    11-24 15:22:16.587: E/AndroidRuntime(19903): FATAL EXCEPTION: main
    11-24 15:22:16.587: E/AndroidRuntime(19903): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.shikechannel/com.example.shikechannel.ChannelActivity}: android.view.InflateException: Binary XML file line #40: Error inflating class com.handmark.pulltorefresh.library.PullToRefreshListView

    看了错误提示就知道应该是是布局方面存在的问题,我的布局中存在:

    <include
    android:id="@+id/chaneltheme"
    layout="@layout/channel_theme" />

    没有把这个include放在一个布局中,结果和下面的有些冲突,

    正确的方式是:

    <RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:background="#ffffff"
    >
    <include
    android:id="@+id/chaneltheme"
    layout="@layout/channel_theme" />
    </RelativeLayout>

    这样的话,效果好,才不会报错误,

    菜鸟花了两个小时才明天的道理:

    1、一定学会看LogCat 方向错误,不要在正确地方浪费过多的时间。

    2、Android布局还要好好的学习学习。

  • 相关阅读:
    简单工厂笔记
    P3369 【模板】普通平衡树 Treap树堆学习笔记
    tp5阿里云短信验证码
    centos 安装php
    tp6.0.2开启多应用模式
    linux navicat最新版过期
    git commit之后 取消commit
    服务器重置之后ssh root@报错
    git pull push 每次都需要输入账号和密码
    跨域问题 php
  • 原文地址:https://www.cnblogs.com/zhoujn/p/4118923.html
Copyright © 2011-2022 走看看