作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在构建一个同时使用 android-spinnerwheel 和 cardsLib 库的应用程序。SpinnerWheel 工作得很好,但是当我尝试使用滑动来删除 cardsLib 的功能时,spinnerWheel 出现了问题。错误是这样的:
06-21 10:43:04.873 17102-17102/com.bitcoinwatcher.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:638)
at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
at antistatic.spinnerwheel.AbstractWheelView.recreateAssets(AbstractWheelView.java:185)
at antistatic.spinnerwheel.AbstractWheel.onLayout(AbstractWheel.java:457)
我想我需要以某种方式告诉轮子它被删除了,但我无法找到具体的方法。即使我设法这样做,它也发生在我实现之前:
@Override
public void onSwipe(Card card) {
}
@Override
public void onUndoSwipe(Card card) {
}
}
最佳答案
好吧,解决方案很简单。看起来 CardsLib 连续绘制 slider ,即使 slider 不可见,导致它以位图宽度/高度 0 绘制。添加以下安全检查
if (width == 0 || height == 0)
return;
AbstractWheelView.java
解决了这个问题。所以总而言之,
protected void recreateAssets(int width, int height) {
if (width == 0 || height == 0)
return;
mSpinBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
mSeparatorsBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
setSelectorPaintCoeff(0);
}
关于android - 带有 SpinnerWheel 库的 CardsLib - 滑动时获取宽度和高度必须 > 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24339576/
我想在 WheelHorizontalView(包含在库 android-spinnerwheel 中)中设置单独的选项卡宽度和高度。并将该选项卡设置为支持选择/按下状态的可绘制对象。 这可以在
我正在构建一个同时使用 android-spinnerwheel 和 cardsLib 库的应用程序。SpinnerWheel 工作得很好,但是当我尝试使用滑动来删除 cardsLib 的功能时,sp
我是一名优秀的程序员,十分优秀!