NovelReader
NovelReader copied to clipboard
如果解决滑动模式下添加自定义布局设置view点击事件的问题?
如题,类似在章节末尾增加按钮,并可以设置点击事件,但是滑动模式下如果准确获取自定义布局的坐标呢?
我是将自定义布局的view转换成bitmap画到画布上的,但我始终只能得到一个初始坐标,滑动的时候无法准备获取anim执行之后的坐标,这样就无法设置点击事件了
使用RectF,将你的Bitmap绘制在RectF区域内,然后,上下滚动的时候,能收到上下滚动的距离,然后再给RectF做上下距离的变换: public RectF(float left, float top, float right, float bottom) { this.left = left; this.top = top; this.right = right; this.bottom = bottom; }
good idea