为什么android:dividerPadding导致android.view.InflateException

时间:2015-09-18 10:01:09

标签: java android

=======================the crash log========================
09-18 17:07:55.627: D/PullToRefresh(16783): First Visible: 0. Visible Count: 0. Total Items:0
09-18 17:07:55.627: D/PullToRefresh(16783): Setting mode to: BOTH
09-18 17:07:55.627: D/PullToRefresh(16783): Setting Padding. L: 14, T: 0, R: 14, B: 0
09-18 17:07:55.637: I/System.out(16783): params---->at=cc0add13205747e4bd9b93dc50da563a&d=1054&b=9&c=0&a=1
09-18 17:07:55.637: D/AndroidRuntime(16783): Shutting down VM
09-18 17:07:55.637: W/dalvikvm(16783): threadid=1: thread exiting with uncaught exception (group=0x417e5d58)
09-18 17:07:55.637: E/AndroidRuntime(16783): **FATAL EXCEPTION**: main
09-18 17:07:55.637: E/AndroidRuntime(16783): Process: com.xp.lvbh, PID: 16783
09-18 17:07:55.637: E/AndroidRuntime(16783): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xp.lvbh/com.xp.lvbh.circle.view.Circle_master_info}: android.view.InflateException: Binary XML file line #47: Error inflating class com.handmark.pulltorefresh.library.PullToRefreshListView
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2192)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2241)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.app.ActivityThread.access$800(ActivityThread.java:141)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1204)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.os.Handler.dispatchMessage(Handler.java:102)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.os.Looper.loop(Looper.java:136)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.app.ActivityThread.main(ActivityThread.java:5049)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at java.lang.reflect.Method.invokeNative(Native Method)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at java.lang.reflect.Method.invoke(Method.java:515)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at dalvik.system.NativeStart.main(Native Method)
09-18 17:07:55.637: E/AndroidRuntime(16783): Caused by: android.view.InflateException: Binary XML file line #47: Error inflating class com.handmark.pulltorefresh.library.PullToRefreshListView
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.view.LayoutInflater.createView(LayoutInflater.java:623)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:699)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.xp.lvbh.circle.view.Pager_circle_travels.init(Pager_circle_travels.java:103)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.xp.lvbh.circle.view.Pager_circle_travels.<init>(Pager_circle_travels.java:90)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.xp.lvbh.circle.view.Circle_master_info.addPagerView(Circle_master_info.java:200)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.xp.lvbh.circle.view.Circle_master_info.init(Circle_master_info.java:180)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.xp.lvbh.others.base.Lvbh_activity_base.onCreate(Lvbh_activity_base.java:42)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.app.Activity.performCreate(Activity.java:5249)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2156)
09-18 17:07:55.637: E/AndroidRuntime(16783):    ... 11 more
09-18 17:07:55.637: E/AndroidRuntime(16783): Caused by: java.lang.reflect.InvocationTargetException
09-18 17:07:55.637: E/AndroidRuntime(16783):    at java.lang.reflect.Constructor.constructNative(Native Method)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.view.LayoutInflater.createView(LayoutInflater.java:597)
09-18 17:07:55.637: E/AndroidRuntime(16783):    ... 24 more
09-18 17:07:55.637: E/AndroidRuntime(16783): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x5/d=0x501 a=5 r=0x7f08001d}
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.content.res.Resources.loadDrawable(Resources.java:2119)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.content.res.MiuiResources.loadDrawable(MiuiResources.java:348)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.content.res.Resources.loadDrawable(Resources.java:2072)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.handmark.pulltorefresh.library.internal.LoadingLayout.<init>(LoadingLayout.java:164)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.handmark.pulltorefresh.library.internal.FlipLoadingLayout.<init>(FlipLoadingLayout.java:41)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.handmark.pulltorefresh.library.PullToRefreshBase$AnimationStyle.createLoadingLayout(PullToRefreshBase.java:1335)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.handmark.pulltorefresh.library.PullToRefreshBase.createLoadingLayout(PullToRefreshBase.java:593)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.handmark.pulltorefresh.library.PullToRefreshBase.init(PullToRefreshBase.java:1115)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.handmark.pulltorefresh.library.PullToRefreshBase.<init>(PullToRefreshBase.java:114)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.handmark.pulltorefresh.library.PullToRefreshAdapterViewBase.<init>(PullToRefreshAdapterViewBase.java:75)
09-18 17:07:55.637: E/AndroidRuntime(16783):    at com.handmark.pulltorefresh.library.PullToRefreshListView.<init>(PullToRefreshListView.java:50)
09-18 17:07:55.637: E/AndroidRuntime(16783):    ... 27 more

===========================the key code of layout file=================

    <com.handmark.pulltorefresh.library.PullToRefreshListView
    android:id="@+id/listview_member_youji"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/radio_travel_mark"
    android:background="@color/background_grey"
    android:divider="@color/transparent"
    android:dividerPadding="@dimen/spacing_small"/>

==========================the key java code=========================
    public Pager_circle_travels(Context context, String circleId) {
        super(context);
        this.context = context;
        this.circle_id = circleId;
        init();
    }

    public Pager_circle_travels(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
        init();
    }


    private void init() {
        inflater = LayoutInflater.from(context);

        this.addView(inflater.inflate(R.layout.pager_circle_detail_travel, null), new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

        radio_travel = (RadioGroup) findViewById(R.id.radio_travel_mark);

        imageView_top = (ImageView) findViewById(R.id.imageView_top_travel);

        listView_travels =  (PullToRefreshListView) findViewById(R.id.listview_member_youji);

这很奇怪,因为当我删除android:dividerPadding="@dimen/spacing_small"时,它没问题。怎么会这样?

我检查了PullToRefresh frame,它没有关于dividerPadding的代码,所以它不会发生冲突。这个问题已经避免了,但我想知道它为什么会发生。

1 个答案:

答案 0 :(得分:0)

如果您打算在ListView项目之间获取空间,可以使用android:dividerHeight =“@ dimen / spacing_small”。