百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

android-otpview-pinview

> 安全
开源

一个自定义视图,用于输入不同大小的 OTP,通常用于身份验证。

726 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个自定义视图,用于输入不同大小的 OTP,通常用于身份验证。

Compose OtpView/PinView

A custom control to enter a code usually in cases of authentication.

        

Supporting Compose OtpView/PinView

Compose PinView/OtpView is an independent project with ongoing development and support made possible thanks to your donations.

  • Become a backer

How to integrate into your app?

Integrating the project is simple. All you need to do is follow the below steps

Step 1. Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url "https://jitpack.io" }
  }
}

Step 2. Add the dependency for Compose

dependencies {
        implementation 'com.github.mukeshsolanki.android-otpview-pinview:otpview-compose:3.1.0'
}

for View system

dependencies {
        implementation 'com.github.mukeshsolanki.android-otpview-pinview:otpview:3.1.0'
}

How to use the library?

Okay seems like you integrated the library in your project but how do you use it? Well its really easy.

  • Using Compose Just use the OtpView composable where you need to display the view like.
var otpValue by remember { mutableStateOf("") }
OtpView(
    otpText = otpValue,
    onOtpTextChange = {
        otpValue = it
        Log.d("Actual Value", otpValue)
    },
    type = OTP_VIEW_TYPE_BORDER,
    password = true,
    containerSize = 48.dp,
    passwordChar = "•",
    keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
    charColor = Color.White
)
  • Using Older View System (aka XML) Add the view in your xml file like

Next in your code assign otp_view to a variable like

val otpView = findViewById(R.id.otp_view)

implement OnOtpCompletionListener

otpView.setOtpCompletionListener {
    Log.d("Actual Value", it)
}

That's pretty much it and your all wrapped up.

Author

Maintained by Mukesh Solanki

Contribution

  • Bug reports and pull requests are welcome.

License

…

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Javaandroidandroid-libraryandroid-pinviewauthentication

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类安全
定价开源

> 相关工具

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.