我尝试设置ScrollVIEw的android:scrollbars =“none”属性,但问题是在输入信息时键盘已启动然后如果您尝试滚动则不会滚动直到布局结束.
我使用下面的代码行隐藏滚动条,< ScrollVIEw>标签在布局中
androID:scrollbarThumbVertical="@null"
它在三星s4设备上运行得很好,但在LG它崩溃时有以下异常 –
FATAL EXCEPTION: main java.lang.NullPointerExceptionat androID.Widget.ScrollbarDrawable.setAlpha(ScrollbarDrawable.java: 221)at androID.vIEw.VIEw.onDrawScrollbars(VIEw.java: 11306)at androID.vIEw.VIEw.draw(VIEw.java: 13567)at androID.Widget.FrameLayout.draw(FrameLayout.java: 467)at androID.Widget.ScrollVIEw.draw(ScrollVIEw.java: 1752)at androID.vIEw.VIEw.getdisplayList(VIEw.java: 12512)at androID.vIEw.VIEw.getdisplayList(VIEw.java: 12556)at androID.vIEw.VIEw.draw(VIEw.java: 13285)at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java: 2931)at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java: 2801)at androID.vIEw.VIEw.draw(VIEw.java: 13564)at androID.vIEw.VIEw.getdisplayList(VIEw.java: 12512)at androID.vIEw.VIEw.getdisplayList(VIEw.java: 12556)at androID.vIEw.VIEw.draw(VIEw.java: 13285)at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java: 2931)at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java: 2801)at androID.vIEw.VIEw.draw(VIEw.java: 13564)at androID.Widget.FrameLayout.draw(FrameLayout.java: 467)at androID.vIEw.VIEw.getdisplayList(VIEw.java: 12512)at androID.vIEw.VIEw.getdisplayList(VIEw.java: 12556)at androID.vIEw.VIEw.draw(VIEw.java: 13285)at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java: 2931)at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java: 2801)at androID.vIEw.VIEw.getdisplayList(VIEw.java: 12510)at androID.vIEw.VIEw.getdisplayList(VIEw.java: 12556)at androID.vIEw.VIEw.draw(VIEw.java: 13285)at androID.vIEw.VIEwGroup.drawChild(VIEwGroup.java: 2931)at androID.vIEw.VIEwGroup.dispatchDraw(VIEwGroup.java: 2801)at androID.vIEw.VIEw.draw(VIEw.java: 13564)at androID.Widget.FrameLayout.draw(FrameLayout.java: 467)at com.androID.internal.policy.impl.PhoneWindow$DecorVIEw.draw(PhoneWindow.java: 2473)at androID.vIEw.HarDWareRenderer$glrenderer.draw(HarDWareRenderer.java: 1206)at androID.vIEw.VIEwRootImpl.draw(VIEwRootImpl.java: 2169)at androID.vIEw.VIEwRootImpl.performDraw(VIEwRootImpl.java: 2041)at androID.vIEw.VIEwRootImpl.performTraversals(VIEwRootImpl.java: 1849)at androID.vIEw.VIEwRootImpl.doTraversal(VIEwRootImpl.java: 1009)at androID.vIEw.VIEwRootImpl$TraversalRunnable.run(VIEwRootImpl.java: 4256)at androID.vIEw.Choreographer$CallbackRecord.run(Choreographer.java: 725)at androID.vIEw.Choreographer.doCallbacks(Choreographer.java: 555)at androID.vIEw.Choreographer.doFrame(Choreographer.java: 525)at androID.vIEw.Choreographer$FramedisplayEventReceiver.run(Choreographer.java: 711)at androID.os.Handler.handleCallback(Handler.java: 615)at androID.os.Handler.dispatchMessage(Handler.java: 92)at androID.os.Looper.loop(Looper.java: 137)at androID.app.ActivityThread.main(ActivityThread.java: 4917)at java.lang.reflect.Method.invokeNative(Native Method)at java.lang.reflect.Method.invoke(Method.java: 511)at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 790)at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java: 557)at dalvik.system.NativeStart.main(Native Method)
是什么原因它在某些设备上运行而不是全部?
唯一正确的选择是通过以下方式设置它 – 如下所示 –
yourScrollVIEw.setVerticalScrollbarEnabled(false);
解决方法:
@null值导致NullPointerException.您可以使用透明drawable:
androID:scrollbarThumbVertical="@androID:color/transparent"
总结 以上是内存溢出为你收集整理的android – 隐藏ScrollView棒在某些设备上给出空指针异常全部内容,希望文章能够帮你解决android – 隐藏ScrollView棒在某些设备上给出空指针异常所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)