1.注入依赖
在Gradle Scripts中的build.gradle(Module:app):
dependencies { implementation "androidx.biometric:biometric:1.1.0" }
2.事件触发 xml布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:onClick="fingerprint"
android:text="指纹识别"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</Button>
</LinearLayout>
3.声明权限
@