android身高控件_GitHub - hnsycsxhzcsh/RulerView: Android自定义控件RulerView,仿唯品会身高、体重等标尺,尺码控件,滑动可修改刻度值(Androi...

本文介绍了Android开发中一个自定义控件RulerView的使用,该控件模仿了唯品会的身高、体重标尺,允许用户滑动修改刻度值。通过在项目中引入JitPack存储库,添加依赖,然后在布局文件中引用控件并设置监听,可以轻松实现尺码控制功能。
摘要由CSDN通过智能技术生成

RulerView

Android custom control RulerView, imitation only products will height, weight and other rulers, size control, slide to modify the scale value

自定义控件,身高、体重等标尺控件

Rendering

效果图

The method referenced in the project:

项目中引用的方法:

Step 1. Add the JitPack repository to your build file

步骤1.将JitPack存储库添加到构建文件中

项目的根build.gradle中添加以下代码:

allprojects {

repositories {

...

maven { url 'https://jitpack.io' }

}

}

Step 2. Add the dependency

步骤2.build.gradle添加依赖项

dependencies {

implementation 'com.github.hnsycsxhzcsh:RulerView:v1.3'

}

Step 3. Reference control in layout

步骤3. 布局中引用控件

android:id="@+id/sizeview_kg"

android:layout_width="match_parent"

android:layout_height="wrap_content"

app:currentValue="76"

app:maxValue="150"

app:minValue="45"

app:titleName="体重"

app:unitName="kg" />

Step 4. Add listener to the activity

步骤4. activity中添加监听

mSizeViewKg = findViewById(R.id.sizeview_kg);

//设置初始化值

mSizeViewKg.setCurrentValue(89);

mSizeViewKg.setOnValueChangeListener(new SizeViewValueChangeListener() {

@Override

public void onValueChange(int value) {

//获取现在的值

}

});

If my control helps you, please help click on the top right corner, thank you!

如果有帮助到大家希望点下右上角Star,谢谢!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值