在财经和银行类应用中,app通常会提供自己安全键盘,以防密码泄露;
<android.inputmethodservice.KeyboardView
android:id="@+id/keyboard_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:keyBackground="@drawable/btn_keyboard_key"
android:keyTextColor="#ffffffff"
android:visibility="gone" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.inputmethodservice.KeyboardView
android:id="@+id/keyboard_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:keyBackground="@drawable/btn_keyboard_key"
android:keyTextColor="#ffffffff"
android:visibility="gone" />
<RelativeLayout/>
KeyboardView mKeyboardView;
mKeyboardView = (KeyboardView)findViewById(R.id.keyboard_view);
new SecKeyboardView(this, mPassword,mKeyboardView);
dependencies {
compile 'com.kejiwen.securitykeyboard:securitykeyboardlibrary:1.0.0'
}