身高、体重横向滚动刻度尺选择器
更新:
1、增加体重支持小数点的选择方式的自定义View
<com.lost.zou.scaleruler.view.DecimalScaleRulerViewandroid:id="@+id/ruler_weight"android:layout_width="match_parent"android:layout_height="58dp"android:layout_alignParentBottom="true" />
mWeightRulerView.setParam(DrawUtil.dip2px(10), DrawUtil.dip2px(32), DrawUtil.dip2px(24),DrawUtil.dip2px(14), DrawUtil.dip2px(9), DrawUtil.dip2px(12));mWeightRulerView.initViewParam(mWeight, 20.0f, 200.0f, 1);mWeightRulerView.setValueChangeListener(new DecimalScaleRulerView.OnValueChangeListener() {@Overridepublic void onValueChange(float value) {mWeightValueTwo.setText(value + "kg");mWeight = value;}});
2、增加一个倾斜的TextView的自定义View实现:
<com.lost.zou.scaleruler.view.SlantedTextViewandroid:layout_width="48dp"android:layout_height="48dp"app:slantedBackgroundColor="@color/colorPrimary"app:slantedLength="28dp"app:slantedMode="left"app:slantedText="体重"app:slantedTextColor="#ffffff"app:slantedTextSize="14sp" />
使用:
<com.lost.zou.scaleruler.view.ScaleRulerViewandroid:id="@+id/scaleWheelView_height"android:layout_width="match_parent"android:layout_height="45dp"android:layout_marginTop="36dp"android:background="@android:color/white"android:paddingLeft="30dp"android:paddingRight="30dp" />
效果图如下:
github地址:/ZBJDSBJ/ScaleRuler
如果觉得《Android:身高 体重横向滚动刻度尺选择器》对你有帮助,请点赞、收藏,并留下你的观点哦!