標籤:android io ar sp java on art 問題 log
菜鳥經過了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布局還要好好的學習學習。
Android代碼沒有錯誤,但是運行出錯