在Android Studio中使用以下代码来获取 biometric prompt 的内部字符串:
String title = context.getString(com.android.internal.R.string.biometric_dialog_title);
String subtitle = context.getString(com.android.internal.R.string.biometric_dialog_subtitle);
String negativeButtonText = context.getString(com.android.internal.R.string.cancel);
其中,context
为当前的上下文。
注意:使用 com.android.internal.R.string
需要添加如下依赖:
implementation 'com.android.support:support-v4:28.0.0'
另外,许多 biometric prompt 的应用程序已经定义了自己的字符串资源,因此您还可以使用以下代码来获取这些资源:
String title = context.getString(R.string.biometric_dialog_title);
String subtitle = context.getString(R.string.biometric_dialog_subtitle);
String negativeButtonText = context.getString(R.string.cancel);
其中,R
是您的应用程序包名的资源类。