RulerView icon indicating copy to clipboard operation
RulerView copied to clipboard

指定位置使用computeScrollTo 能不能去掉动画

Open cowoboy007 opened this issue 6 years ago • 11 comments

指定位置使用computeScrollTo 能不能去掉动画,现在界面出来,会一下子滑动过去,体验比较差

cowoboy007 avatar Aug 10 '20 15:08 cowoboy007

你好,使用过firstScale这个属性吗?这个是默认刻度值,也就是尺子默认加载值,computeScrollTo 是指定跳转值

superSp avatar Aug 12 '20 01:08 superSp

用代码设置firstScale,是实际的10倍,没办法了我才用computeScrollTo

cowoboy007 avatar Aug 12 '20 03:08 cowoboy007

10倍?不太理解,要不贴一下布局代码 我看一下

superSp avatar Aug 12 '20 05:08 superSp

https://github.com/superSp/RulerView/issues/8,可以看下这个,和这个一样,比如设置16,界面会显示160

cowoboy007 avatar Aug 12 '20 05:08 cowoboy007

我刚刚按照那个布局设置 在oncreate中 rulerView.setFirstScale(58.0f) 还是没有复现bug。。

superSp avatar Aug 12 '20 06:08 superSp

<com.bbstrong.libui.edittext.RulerView android:id="@+id/rulerView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="30dp" android:layout_marginBottom="20dp" lsp:scaleLimit="10" lsp:bgColor="#fcfffc" lsp:firstScale="160" lsp:isBgRoundRect="false" lsp:largeScaleColor="@color/color_2fb9ff" lsp:largeScaleStroke="5dp" lsp:minScale="0" lsp:maxScale="250" lsp:midScaleColor="#999999" lsp:midScaleStroke="3dp" lsp:resultNumColor="@color/color_2fb9ff" lsp:resultNumTextSize="20sp" lsp:rulerHeight="50dp" lsp:rulerToResultgap="30dp" lsp:scaleCount="10" lsp:scaleGap="10dp" lsp:scaleNumColor="#666666" lsp:scaleNumTextSize="16sp" lsp:showScaleResult="true" lsp:smallScaleColor="#aaaaaa" lsp:smallScaleStroke="2dp" lsp:unit="cm" lsp:unitColor="@color/color_2fb9ff" lsp:unitTextSize="10sp" /> 布局这么写,然后代码setFirstScale(16),出来效果是160

cowoboy007 avatar Aug 12 '20 12:08 cowoboy007

我试一下

superSp avatar Aug 13 '20 06:08 superSp

我试了还是没问题。。。 rulerView.setFirstScale(16F) 这里应该是16F吧 方法里面接收的是float类型

superSp avatar Aug 13 '20 06:08 superSp

怎么试,都是160.。。麻烦确认下之前别人提的问题吧。应该不是我一个人这样

cowoboy007 avatar Aug 13 '20 14:08 cowoboy007

怎么试,都是160.。。麻烦确认下之前别人提的问题吧。应该不是我一个人这样

嗯,有多个人提过肯定就是有问题了,不知道是不是布局还是其他问题,我这边不太好复现,等工作不忙了,我再试试

superSp avatar Aug 18 '20 01:08 superSp

10倍这个问题是因为setMinScale setFirstScale setMaxScale三个方法和属性初始化时候的方法不一样,里面需要加 / scaleLimit 就正常了,但是实现还是不怎么友好。。 image

auhah avatar Dec 30 '20 07:12 auhah