From be501a918958602adb4ebc239ed15cbb53714930 Mon Sep 17 00:00:00 2001 From: WXFY Date: Fri, 28 Dec 2018 14:50:34 +0800 Subject: [PATCH] Update README.md --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/README.md b/README.md index 51ac1e1..c775417 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,59 @@ [![](https://jitpack.io/v/WXFY/Ruler.svg)](https://jitpack.io/#WXFY/Ruler) + +图例 + + + +**XMl文件** +``` + +``` + +**代码文件** +``` + WeightChoiceView weight = findViewById(R.id.weight); + weightValue = findViewById(R.id.weight_value); + weight.setListener(new WeightChoiceView.OnValueChangeListener() { + @Override + public void onValueChange(float value) { + weightValue.setText("体重:"+value+"Kg"); + } + }); +``` + +也可以在代码中设置最大值,最小值和选中的值 + +``` + WeightChoiceView weight = findViewById(R.id.weight); + weight.setValue(250,300,100,1.0f); +``` + +最后面的数据是刻度间隔1.0表示间隔1,0.1表示间隔为0.1 + + +| 名称 | 值 | +| :--------: | :-----: | +| 刻度颜色 | mBgPaintColor | +| 默认字体颜色 | mTextPaintColor | +| 默认字体大小 | mTextSize | +| 选中字体大小 | mTextSelectSize | +| 选中字体颜色 | mTextSelectColor | +| 最小值 | min | +| 最大值 | max | +| 刻度间距 | spacing | +| 是否弧度尺 | arc | +| 选中刻度 | mSelectorValue | + +选中刻度只能在最大值和最小值之间,否则刻度不绘制。 + + +**因为自己项目用到的是弧度尺,看到[RuleView](https://github.com/panacena/RuleView)实现直尺思路**