Android recycler查看divideritem 4.4兼容性

Android recycler查看divideritem 4.4兼容性,第1张

概述我在回收器视图中渲染divider项目时只有forandroid4.4,它的工作正常在android5.0中有这个异常java.lang.NullPointerExceptionatandroid.view.GLES20Canvas.setupModifiers(GLES20Canvas.java:1439)atandroid.view.GLES20Canvas.drawLines(GLES20Canvas.j

我在回收器视图中渲染divIDer项目时只有for android 4.4,它的工作正常在androID 5.0中有这个异常

java.lang.NullPointerException        at androID.vIEw.GLES20Canvas.setupModifIErs(GLES20Canvas.java:1439)        at androID.vIEw.GLES20Canvas.drawlines(GLES20Canvas.java:1019)        at androID.vIEw.GLES20Canvas.drawline(GLES20Canvas.java:1009)        at androID.graphics.drawable.GradIEntDrawable.draw(GradIEntDrawable.java:538)        at com.sistac.informecampos.fragments.divIDerItemdecoration.onDrawOver(divIDerItemdecoration.java:35)        at androID.support.v7.Widget.RecyclerVIEw.draw(RecyclerVIEw.java:2444)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13362)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.VIEw.draw(VIEw.java:14182)        at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3103)        at androID.support.design.Widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1040)        at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2940)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13357)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.VIEw.draw(VIEw.java:14182)        at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3103)        at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2940)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13357)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.VIEw.draw(VIEw.java:14182)        at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3103)        at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2940)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13357)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.VIEw.draw(VIEw.java:14182)        at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3103)        at androID.support.v4.Widget.DrawerLayout.drawChild(DrawerLayout.java:1229)        at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2940)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13357)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.VIEw.draw(VIEw.java:14182)        at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3103)        at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2940)        at androID.vIEw.VIEw.draw(VIEw.java:14468)        at androID.Widget.FrameLayout.draw(FrameLayout.java:472)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13362)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.VIEw.draw(VIEw.java:14182)        at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3103)        at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2940)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13357)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.VIEw.draw(VIEw.java:14182)        at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3103)        at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2940)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13357)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.VIEw.draw(VIEw.java:14182)        at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3103)        at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2940)        at androID.vIEw.VIEw.draw(VIEw.java:14468)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13362)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.VIEw.draw(VIEw.java:14182)        at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java:3103)        at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java:2940)        at androID.vIEw.VIEw.draw(VIEw.java:14468)        at androID.Widget.FrameLayout.draw(FrameLayout.java:472)        at com.androID.internal.policy.impl.PhoneWindow$DecorVIEw.draw(PhoneWindow.java:2326)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13362)        at androID.vIEw.VIEw.getdisplayList(VIEw.java:13404)        at androID.vIEw.HarDWareRenderer$glrenderer.builddisplayList(HarDWareRenderer.java:1570)        at androID.vIEw.HarDWareRenderer$glrenderer.draw(HarDWareRenderer.java:1449)        at androID.vIEw.VIEwRootImpl.draw(VIEwRootImpl.java:2377)        at androID.vIEw.VIEwRootImpl.performDraw(VIEwRootImpl.java:2249)        at androID.vIEw.VIEwRootImpl.performTraversals(VIEwRootImpl.java:1879)        at androID.vIEw.VIEwRootImpl.doTraversal(VIEwRootImpl.java:996)        at androID.vIEw.VIEwRootImpl$TraversalRunnable.run(VIEwRootImpl.java:

我的divIDerItem实现覆盖

 @OverrIDepublic voID onDrawOver(Canvas c, RecyclerVIEw parent, RecyclerVIEw.State state) {    int left = parent.getpaddingleft();    int right = parent.getWIDth() - parent.getpaddingRight();    int childCount = parent.getChildCount();    for (int i = 0; i < childCount; i++) {        VIEw child = parent.getChildAt(i);        RecyclerVIEw.LayoutParams params = (RecyclerVIEw.LayoutParams) child.getLayoutParams();        int top = child.getBottom() + params.bottommargin;        int bottom = top + mdivIDer.getIntrinsicHeight();        mdivIDer.setBounds(left, top, right, bottom);        mdivIDer.draw(c);    }<androID.support.design.Widget.CoordinatorLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:ID="@+ID/main_content"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"><androID.support.v7.Widget.RecyclerVIEw    androID:ID="@+ID/grID"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent" /><include layout="@layout/new_fab" />

它非常简单.是否有任何建议的步骤来识别和修复这些错误?

谢谢,
乔治

解决方法:

这对我有帮助:改变divIDer xml

<?xml version="1.0" enCoding="utf-8"?><shape xmlns:androID="http://schemas.androID.com/apk/res/androID"       androID:shape="line">    <solID androID:color="#00000000"/>    <size androID:height="1dp"/></shape>

<?xml version="1.0" enCoding="utf-8"?><shape xmlns:androID="http://schemas.androID.com/apk/res/androID"       androID:shape="line">    <stroke androID:color="#00000000"/>    <size androID:height="1dp"/></shape>

改变固体到中风

总结

以上是内存溢出为你收集整理的Android recycler查看divideritem 4.4兼容性全部内容,希望文章能够帮你解决Android recycler查看divideritem 4.4兼容性所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1115734.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存