Skip to content

Repository files navigation

NumberKeyboard

Custom keyboardview with two ways:

  1. Override systems's sys.xml of keyboardview
  2. Custom the layout and slove the touchListener's question and so on...

For example: MeiTuan's Merchant or NuoMi's Merchant app, Number Keyboard

Show parts codes:

publicclassMainActivityextendsAppCompatActivityimplementsView.OnClickListener, NumberKeyboardUtil.OnPopuWindowListenerprivatevoidinitView(){
etCode = ButterKnife.findById(inputLayout, R.id.et_code);
keyboardPopupwindow = NumberKeyboardPopupWindow.getInstance(this).onCreate(this);
NumberKeyboardUtil.getInstance().setOnTouchListener(etCode, keyboardPopupwindow, this);
NumberKeyboardUtil.getInstance().disableCopyAndPaste(etCode);
}
@OverridepublicvoidshowPopuWindow() {
etCode.requestFocus();
keyboardPopupwindow.showAsDropDown(llTop);
}
@Overridepublicvoiddismiss() {
etCode.getText().clear();
etCode.clearFocus();
keyboardPopupwindow.dismiss();
}
@OverridepublicvoidinsertStr(Stringstr) {
intindex = etCode.getSelectionStart();
if (index < 0 || index >= etCode.getText().toString().length()) {
etCode.append(str);
} else {
etCode.getEditableText().insert(index, str);
}
}
@Overridepublicvoidcheck() {
Toast.makeText(this, "check", Toast.LENGTH_SHORT).show();
}

Thanks:

Jakewharton-Butterknife

About

For example meituan's mechant NumberKeyboard

Resources

Stars

48 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages