Coder Social home page Coder Social logo

androidsecuritykeyboard's Introduction

#Android安全密码键盘 ##简介

在财经和银行类应用中,app通常会提供自己安全键盘,以防密码泄露;
shot1 shot2

##使用

###第一步:在需要安全键盘的Activity或则Fragment的布局文件中加入如下代码:

<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,则在底部加入如下代码:

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <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/>

第二步:在需要安全键盘的Activity或则Fragment的onCreate()方法或则onCreateView()方法中加入如下代码:

KeyboardView mKeyboardView;
mKeyboardView =   (KeyboardView)findViewById(R.id.keyboard_view);
new SecKeyboardView(this, mPassword,mKeyboardView);

##Android Studio快速集成

dependencies {

compile 'com.kejiwen.securitykeyboard:securitykeyboardlibrary:1.0.0'

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.