android.view.InflateException: Binary XML file line #49: Binary XML file line #49: Error inflating class com.willy.ratingbar.ScaleRatingBar
Caused by: android.view.InflateException: Binary XML file line #49: Error inflating class com.willy.ratingbar.ScaleRatingBar
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
at com.chad.library.adapter.base.BaseQuickAdapter.getItemView(BaseQuickAdapter.java:1518)
at com.chad.library.adapter.base.BaseQuickAdapter.createBaseViewHolder(BaseQuickAdapter.java:1022)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateDefViewHolder(BaseQuickAdapter.java:1018)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:774)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:68)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6685)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5869)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5752)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5748)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2232)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1559)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1519)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:614)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3812)
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3225)
at android.view.View.measure(View.java:20049)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:20049)
at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1450)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:516)
at android.view.View.measure(View.java:20049)
at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1619)
at android.view.View.measure(View.java:20049)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:20049)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:20049)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:20049)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141)
at android.view.View.measure(View.java:20049)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:20049)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:20049)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
at android.view.View.measure(View.java:20049)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:729)
at android.view.View.measure(View.java:20049)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2604)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1602)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1855)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1490)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7036)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:878)
at android.view.Choreographer.doCallbacks(Choreographer.java:690)
at android.view.Choreographer.doFrame(Choreographer.java:625)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:864)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:185)
at android.app.ActivityThread.main(ActivityThread.java:6615)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:916)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:806)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable$ConstantState android.graphics.drawable.Drawable.getConstantState()' on a null object reference
at com.willy.ratingbar.PartialView.setFilledDrawable(PartialView.java:62)
at com.willy.ratingbar.BaseRatingBar.getPartialView(BaseRatingBar.java:138)
at com.willy.ratingbar.BaseRatingBar.initRatingView(BaseRatingBar.java:128)
at com.willy.ratingbar.BaseRatingBar.(BaseRatingBar.java:78)
at com.willy.ratingbar.BaseRatingBar.(BaseRatingBar.java:62)
at com.willy.ratingbar.AnimationRatingBar.(AnimationRatingBar.java:27)
at com.willy.ratingbar.ScaleRatingBar.(ScaleRatingBar.java:24)
你好 @ome450901 ,在使用你的控件过程中出现了这个问题。设备是OPPO R11s Plus,系统版本7.1.1 这个是什么原因导致的呢?
android.view.InflateException: Binary XML file line #49: Binary XML file line #49: Error inflating class com.willy.ratingbar.ScaleRatingBar Caused by: android.view.InflateException: Binary XML file line #49: Error inflating class com.willy.ratingbar.ScaleRatingBar Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:430) at android.view.LayoutInflater.createView(LayoutInflater.java:645) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727) at android.view.LayoutInflater.rInflate(LayoutInflater.java:858) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821) at android.view.LayoutInflater.inflate(LayoutInflater.java:518) at android.view.LayoutInflater.inflate(LayoutInflater.java:426) at com.chad.library.adapter.base.BaseQuickAdapter.getItemView(BaseQuickAdapter.java:1518) at com.chad.library.adapter.base.BaseQuickAdapter.createBaseViewHolder(BaseQuickAdapter.java:1022) at com.chad.library.adapter.base.BaseQuickAdapter.onCreateDefViewHolder(BaseQuickAdapter.java:1018) at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:774) at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:68) at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6685) at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5869) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5752) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5748) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2232) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1559) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1519) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:614) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3812) at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3225) at android.view.View.measure(View.java:20049) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:20049) at android.support.v4.widget.NestedScrollView.measureChildWithMargins(NestedScrollView.java:1450) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.support.v4.widget.NestedScrollView.onMeasure(NestedScrollView.java:516) at android.view.View.measure(View.java:20049) at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1619) at android.view.View.measure(View.java:20049) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:20049) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:20049) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:20049) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141) at android.view.View.measure(View.java:20049) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:20049) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:20049) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464) at android.widget.LinearLayout.measureVertical(LinearLayout.java:758) at android.widget.LinearLayout.onMeasure(LinearLayout.java:640) at android.view.View.measure(View.java:20049) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6359) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:729) at android.view.View.measure(View.java:20049) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2604) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1602) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1855) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1490) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7036) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:878) at android.view.Choreographer.doCallbacks(Choreographer.java:690) at android.view.Choreographer.doFrame(Choreographer.java:625) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:864) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:185) at android.app.ActivityThread.main(ActivityThread.java:6615) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:916) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:806) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable$ConstantState android.graphics.drawable.Drawable.getConstantState()' on a null object reference at com.willy.ratingbar.PartialView.setFilledDrawable(PartialView.java:62) at com.willy.ratingbar.BaseRatingBar.getPartialView(BaseRatingBar.java:138) at com.willy.ratingbar.BaseRatingBar.initRatingView(BaseRatingBar.java:128) at com.willy.ratingbar.BaseRatingBar.(BaseRatingBar.java:78)
at com.willy.ratingbar.BaseRatingBar.(BaseRatingBar.java:62)
at com.willy.ratingbar.AnimationRatingBar.(AnimationRatingBar.java:27)
at com.willy.ratingbar.ScaleRatingBar.(ScaleRatingBar.java:24)