Giter VIP home page Giter VIP logo

ppg408331701l's Introduction

DigitalKeyboard

简单的仿微信数字键盘

image  

公司有多个项目都需要这样的数字键盘,并不是用来代替传统的keyboard,

而是在输入类似 PIN码或者支付密码时使用,一般把它放在dialog或者popupwindow中弹出

对于Android Studio的用户,可以选择添加:

allprojects {
	repositories {
	...
	maven { url 'https://jitpack.io' }
	}
}
	   compile 'com.github.ppg408331701:DigitalKeyboard:v1.0.0'
           
配置参数 参数含义
DK_text_color键盘中的所有文本的颜色
DK_line_color键盘中分割线和边框的颜色

在xml中使用

 <com.ppg.digitalnumkeyboard.DigitalNumKeyboard
        android:id="@+id/DigitalNumKeyboard"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">
    </com.ppg.digitalnumkeyboard.DigitalNumKeyboard>
 	edit = (EditText) findViewById(R.id.edit);
        digitalNumKeyboard = (DigitalNumKeyboard) findViewById(R.id.DigitalNumKeyboard);

        digitalNumKeyboard.setOnImgBackListener(new DigitalNumKeyboard.OnImgBackListener() {
            @Override
            public void ImgBackClickListener() {
                digitalNumKeyboard.setVisibility(View.GONE);
            }
        });
        digitalNumKeyboard.setOnNumBtnClickListener(new DigitalNumKeyboard.OnNumBtnClickListener() {
            @Override
            public void NumBtnClickListener(BtnBean btnBean) {
                if (btnBean.getBtn_type() == BtnBean.BTN_TYPE_NUM) {
                    edit.setText(edit.getText().toString() + btnBean.getBtn_text());
                } else if (btnBean.getBtn_type() == BtnBean.BTN_TYPE_POINT) {
                    edit.setText(edit.getText().toString() + btnBean.getBtn_text());
                } else if (btnBean.getBtn_type() == BtnBean.BTN_TYPE_DELETE && edit.getText().length() > 0) {
                    int index = edit.getText().length();   //获取Edittext光标所在位置
                    edit.getText().delete(index - 1, index);
                }
                edit.setSelection(edit.getText().length());
            }
        });

ppg408331701l's People

Contributors

symphobrnett avatar

Stargazers

Zhuang avatar

Watchers

 avatar

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.