android 车牌输入键盘
android 中输入车牌的键盘
完美的键盘输入。妈妈再也不用担心我的键盘了
核心代码:
PpKeyBoardView 中设置键盘中特殊键盘的样式:主要是在public void onDraw(Canvas canvas) 方法中重新绘制
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.Keyboard.Key;
import android.inputmethodservice.KeyboardView;
import android.util.AttributeSet;import java.util.List;public class PpKeyBoardView extends KeyboardView {private Context mContext;private int rightType = 1;// 右下角private int heightPixels;private float density;private static Keyboard mKeyBoard;public PpKeyBoardView(Context context, AttributeSet attrs) {super(context, attrs);this.mContext = context;heightPixels = mContext.getResources().getDisplayMetrics().heightPixels;density = mContext.getResources().getDisplayMetrics().density;}public PpKeyBoardView(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);this.mContext = context;heightPixels = mContext.getResources().getDisplayMetrics().heightPixels;density = mContext.getResources().getDisplayMetrics().density;}/*** 重新画一些按键*/@Overridepublic void onDraw(Canvas canvas) {super.onDraw(canvas);mKeyBoard = KeyboardUtil.getKeyBoardType();List<Key> keys = mKeyBoard.getKeys();for (Key key : keys) {// 数字键盘的处理
// if (mKeyBoard.equals(KeyboardUtil.numKeyboard)) {
// initRightType(key);
// drawNumSpecialKey(key, canvas);
// } elseif (mKeyBoard.equals(KeyboardUtil.abcKeyboard)) {drawABCSpecialKey(key, canvas);} else if (mKeyBoard.equals(KeyboardUtil.symbolKeyboard)) {drawSymbolSpecialKey(key, canvas);} else if(mKeyBoard.equals(KeyboardUtil.abcKeyboardLast)){drawABCSpecialKey(key, canvas);}}}//字母键盘特殊处理背景private void drawABCSpecialKey(Key key, Canvas canvas) {//TODO 待添加特殊处理if (key.codes[0] == -5) {drawKeyBackground(R.drawable.btn_keyboard_key_delete, canvas, key);drawText(canvas, key);}if (key.codes[0] == -1) {drawKeyBackground(R.drawable.btn_keyboard_key_shift, canvas, key);drawText(canvas, key);}if (key.codes[0] == 123123 || key.codes[0] == 789789) {drawKeyBackground(R.drawable.btn_keyboard_key_123, canvas, key);drawText(canvas, key);}if (key.codes[0] == 32) {drawKeyBackground(R.drawable.btn_keyboard_key_space, canvas, key);}if(key.label!=null && ("I".equalsIgnoreCase(key.label.toString()) || "O".equalsIgnoreCase(key.label.toString()))){drawKeyBackground(R.drawable.btn_keyboard_key_123, canvas, key);drawText(canvas, key);}}//标点键盘特殊处理背景private void drawSymbolSpecialKey(Key key, Canvas canvas) {//TODO 待添加特殊处理if (key.codes[0] == 123123 ||key.codes[0] == 456456) {drawKeyBackground(R.drawable.btn_keyboard_key_change, canvas, key);drawText(canvas, key);}if (key.codes[0] == -5) {drawKeyBackground(R.drawable.btn_keyboard_key_delete, canvas, key);}}private void drawKeyBackground(int drawableId, Canvas canvas, Key key) {Drawable npd = (Drawable) mContext.getResources().getDrawable(drawableId);int[] drawableState = key.getCurrentDrawableState();if (key.codes[0] != 0) {npd.setState(drawableState);}npd.setBounds(key.x, key.y, key.x + key.width, key.y+ key.height);npd.draw(canvas);}public int getRightType() {return this.rightType;}private void drawText(Canvas canvas, Key key) {Rect bounds = new Rect();Paint paint = new Paint();paint.setTextAlign(Paint.Align.CENTER);if (key.label!=null && ("I".equalsIgnoreCase(key.label.toString()) || "O".equalsIgnoreCase(key.label.toString()))) {paint.setTextSize(50);} else {paint.setTextSize(44);}paint.setAntiAlias(true);// paint.setTypeface(Typeface.DEFAULT_BOLD);paint.setColor(Color.BLACK);if (mKeyBoard.equals(KeyboardUtil.abcKeyboard)||mKeyBoard.equals(KeyboardUtil.abcKeyboardLast)) {if (key.label != null) {paint.setColor(mContext.getResources().getColor(R.color.color_3c3c3c));paint.getTextBounds(key.label.toString(), 0, key.label.toString().length(), bounds);canvas.drawText(key.label.toString(), key.x + (key.width / 2),(key.y + key.height / 2) + bounds.height() / 2, paint);}} else if (mKeyBoard.equals(KeyboardUtil.symbolKeyboard)) {paint.setColor(mContext.getResources().getColor(R.color.color_3c3c3c));paint.getTextBounds(key.label.toString(), 0, key.label.toString().length(), bounds);canvas.drawText(key.label.toString(), key.x + (key.width / 2),(key.y + key.height / 2) + bounds.height() / 2, paint);}}
}
KeyboardUtil。 主要处理了输入键盘的判断。
public void onKey(int primaryCode, int[] keyCodes)方法中判断了输入的键盘产生的各种事件
package com.ziyeyouhu.library;import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.Keyboard.Key;
import android.inputmethodservice.KeyboardView.OnKeyboardActionListener;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.text.InputType;
import android.text.Selection;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;public class KeyboardUtil {private Context mContext;private int widthPixels;private Activity mActivity;private PpKeyBoardView keyboardView;public static Keyboard abcKeyboard;// 字母键盘public static Keyboard abcKeyboardLast; // 字母键盘最后一位public static Keyboard symbolKeyboard;// 汉字键盘public static Keyboard keyboard;//提供给keyboardView 进行画public boolean isupper = false;// 是否大写public boolean isShow = false;InputFinishListener inputOver;KeyBoardStateChangeListener keyBoardStateChangeListener;private View layoutView;private View keyBoardLayout;// 开始输入的键盘状态设置private static int inputType = 7;// 默认public static final int INPUTTYPE_ABC = 6;// 一般的abcpublic static final int INPUTTYPE_ABC_LAST = 8 ; // abc最后一位汉字的public static final int INPUTTYPE_SYMBOL = 7;// 省份键盘public static final int KEYBOARD_SHOW = 1;public static final int KEYBOARD_HIDE = 2;private EditText ed;private Handler mHandler;private Handler showHandler;// private ScrollView sv_main;private View root_view;private int scrollTo = 0;private KeyboardUtil mKeyboardUtil;private TextView keyboard_tips_tv;private static final float TIPS_MARGIN_W = 0.0407f;private View inflaterView;private ImageView mIVClose;public static final int PLATE_GENERAL_length = 7;public static final int PLATE_NEW_ENERGY_LENGTH = 8;int editLength = PLATE_GENERAL_length;private int editType;/*** 最新构造方法,现在都用这个** @param ctx* @param rootView rootView 需要是LinearLayout,以适应键盘*/public KeyboardUtil(Context ctx, RelativeLayout rootView, ScrollView scrollView) {this.mContext = ctx;this.mActivity = (Activity) mContext;widthPixels = mContext.getResources().getDisplayMetrics().widthPixels;initKeyBoardView(rootView);initScrollHandler(rootView, scrollView);mKeyboardUtil = this;}// 车牌位数 普通车7位 新能源车8位public void setEditType(int editType) {this.editType = editType;if(editType == 0){this.editLength = PLATE_GENERAL_length;}else {this.editLength = PLATE_NEW_ENERGY_LENGTH;}}private void setEditLength(int editLength) {this.editLength = editLength;}/*** 弹框类,用这个** @param view 是弹框的inflaterView*/public KeyboardUtil(View view, Context ctx, RelativeLayout root_View, ScrollView scrollView) {this(ctx, root_View, scrollView);this.inflaterView = view;}//设置监听事件public void setInputOverListener(InputFinishListener listener) {this.inputOver = listener;}public static Keyboard getKeyBoardType() {return keyboard;}private void initKeyBoardView(RelativeLayout rootView) {LayoutInflater inflater = LayoutInflater.from(mContext);keyBoardLayout = inflater.inflate(R.layout.input, null);keyBoardLayout.setVisibility(View.GONE);keyBoardLayout.setBackgroundColor(mActivity.getResources().getColor(R.color.product_list_bac));initLayoutHeight((LinearLayout) keyBoardLayout);this.layoutView = keyBoardLayout;RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,RelativeLayout.LayoutParams.WRAP_CONTENT);lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);//与父容器的左侧对齐keyBoardLayout.setLayoutParams(lp);//设置布局参数rootView.addView(keyBoardLayout);if (keyBoardLayout != null && keyBoardLayout.getVisibility() == View.VISIBLE)Log.d("KeyboardUtil", "visible");}public void initLayoutHeight(LinearLayout layoutView) {LinearLayout.LayoutParams keyboard_layoutlLayoutParams = (LinearLayout.LayoutParams) layoutView.getLayoutParams();RelativeLayout TopLayout = (RelativeLayout) layoutView.findViewById(R.id.keyboard_view_top_rl);mIVClose = (ImageView) layoutView.findViewById(R.id.iv_close);mIVClose.setOnClickListener(new finishListener());
// keyboard_tips_tv = (TextView) layoutView.findViewById(R.id.keyboard_tips_tv);
// TextView keyboard_view_finish = (TextView) layoutView.findViewById(R.id.keyboard_view_finish);
// setMargins(keyboard_tips_tv, (int) (widthPixels * TIPS_MARGIN_W), 0, 0, 0);
// keyboard_tips_tv.setVisibility(View.VISIBLE);
// setMargins(keyboard_view_finish, 0, 0, (int) (widthPixels * TIPS_MARGIN_W), 0);
// keyboard_view_finish.setOnClickListener(new finishListener());if (keyboard_layoutlLayoutParams == null) {int height = (int) (mActivity.getResources().getDisplayMetrics().heightPixels * SIZE.KEYBOARY_H);layoutView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));} else {keyboard_layoutlLayoutParams.height = (int) (mActivity.getResources().getDisplayMetrics().heightPixels * SIZE.KEYBOARY_H);}LinearLayout.LayoutParams TopLayoutParams = (LinearLayout.LayoutParams) TopLayout.getLayoutParams();if (TopLayoutParams == null) {int height = (int) (mActivity.getResources().getDisplayMetrics().heightPixels * SIZE.KEYBOARY_T_H);TopLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, height));} else {TopLayoutParams.height = (int) (mActivity.getResources().getDisplayMetrics().heightPixels * SIZE.KEYBOARY_T_H);}}private void setMargins(View view, int left, int top, int right, int bottom) {if (view.getLayoutParams() instanceof RelativeLayout.LayoutParams) {RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) view.getLayoutParams();layoutParams.setMargins(left, top, right, bottom);} else if (view.getLayoutParams() instanceof LinearLayout.LayoutParams) {LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) view.getLayoutParams();layoutParams.setMargins(left, top, right, bottom);}}public boolean setKeyBoardCursorNew(EditText edit) {this.ed = edit;boolean flag = false;InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);boolean isOpen = imm.isActive();// isOpen若返回true,则表示输入法打开if (isOpen) {
// ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);if (imm.hideSoftInputFromWindow(edit.getWindowToken(), 0))flag = true;}// act.getWindow().setSoftInputMode(
// WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);int currentVersion = android.os.Build.VERSION.SDK_INT;String methodName = null;if (currentVersion >= 16) {// 4.2methodName = "setShowSoftInputOnFocus";} else if (currentVersion >= 14) {// 4.0methodName = "setSoftInputShownOnFocus";}if (methodName == null) {edit.setInputType(InputType.TYPE_NULL);} else {Class<EditText> cls = EditText.class;Method setShowSoftInputOnFocus;try {setShowSoftInputOnFocus = cls.getMethod(methodName,boolean.class);setShowSoftInputOnFocus.setAccessible(true);setShowSoftInputOnFocus.invoke(edit, false);} catch (NoSuchMethodException e) {edit.setInputType(InputType.TYPE_NULL);e.printStackTrace();} catch (IllegalAccessException e) {e.printStackTrace();} catch (IllegalArgumentException e) {e.printStackTrace();} catch (InvocationTargetException e) {e.printStackTrace();}}return flag;}public void hideSystemKeyBoard() {InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);imm.hideSoftInputFromWindow(keyBoardLayout.getWindowToken(), 0);}public void hideAllKeyBoard() {hideSystemKeyBoard();hideKeyboardLayout();}public boolean getKeyboardState() {return this.isShow;}public EditText getEd() {return ed;}//初始化滑动handler@SuppressLint("HandlerLeak")private void initScrollHandler(View rootView, ScrollView scrollView) {// this.sv_main = scrollView;this.root_view = rootView;mHandler = new Handler() {@Overridepublic void handleMessage(Message msg) {super.handleMessage(msg);if (msg.what == ed.getId()) {// if (sv_main != null)
// sv_main.smoothScrollTo(0, scrollTo);}}};}//滑动监听private void keyBoardScroll(final EditText editText, int scorllTo) {this.scrollTo = scorllTo;ViewTreeObserver vto_bighexagon = root_view.getViewTreeObserver();vto_bighexagon.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {@Overridepublic void onGlobalLayout() {Message msg = new Message();msg.what = editText.getId();mHandler.sendMessageDelayed(msg, 500);// // 防止多次促发root_view.getViewTreeObserver().removeGlobalOnLayoutListener(this);}});}//设置一些不需要使用这个键盘的edittext,解决切换问题public void setOtherEdittext(EditText... edittexts) {for (EditText editText : edittexts) {editText.setOnTouchListener(new View.OnTouchListener() {@Overridepublic boolean onTouch(View v, MotionEvent event) {if (event.getAction() == MotionEvent.ACTION_UP) {//防止没有隐藏键盘的情况出现new Handler().postDelayed(new Runnable() {@Overridepublic void run() {hideKeyboardLayout();}}, 300);ed = (EditText) v;hideKeyboardLayout();}return false;}});}}class finishListener implements View.OnClickListener {@Overridepublic void onClick(View v) {hideKeyboardLayout();}}private OnKeyboardActionListener listener = new OnKeyboardActionListener() {@Overridepublic void swipeUp() {}@Overridepublic void swipeRight() {}@Overridepublic void swipeLeft() {}@Overridepublic void swipeDown() {}@Overridepublic void onText(CharSequence text) {if (ed == null)return;Editable editable = ed.getText();
// if (editable.length()>=20)
// return;int start = ed.getSelectionStart();int end = ed.getSelectionEnd();String temp = editable.subSequence(0, start) + text.toString() + editable.subSequence(start, editable.length());ed.setText(temp);Editable etext = ed.getText();Selection.setSelection(etext, start + 1);}@Overridepublic void onRelease(int primaryCode) {if ((primaryCode == Keyboard.KEYCODE_SHIFT)) {keyboardView.setPreviewEnabled(true);}}@Overridepublic void onPress(int primaryCode) {
// if (inputType == KeyboardUtil.INPUTTYPE_NUM_ABC ||
// inputType == KeyboardUtil.INPUTTYPE_NUM ||
// inputType == KeyboardUtil.INPUTTYPE_NUM_POINT ||
// inputType == KeyboardUtil.INPUTTYPE_NUM_FINISH ||
// inputType == KeyboardUtil.INPUTTYPE_NUM_NEXT ||
// inputType == KeyboardUtil.INPUTTYPE_NUM_X) {
// keyboardView.setPreviewEnabled(false);
// return;
// }if (primaryCode == Keyboard.KEYCODE_SHIFT|| primaryCode == Keyboard.KEYCODE_DELETE|| primaryCode == 123123|| primaryCode == 456456|| primaryCode == 789789|| primaryCode == 32) {keyboardView.setPreviewEnabled(false);return;}keyboardView.setPreviewEnabled(true);return;}@Overridepublic void onKey(int primaryCode, int[] keyCodes) {//判定是否是中文的正则表达式 [\\u4e00-\\u9fa5]判断一个中文 [\\u4e00-\\u9fa5]+多个中文String reg = "[\\u4e00-\\u9fa5]";Editable editable = ed.getText();int start = ed.getSelectionStart();if (primaryCode == Keyboard.KEYCODE_CANCEL) {// 收起hideKeyboardLayout();if (inputOver != null)inputOver.inputHasOver(primaryCode, ed);} else if (primaryCode == Keyboard.KEYCODE_DELETE) {// 回退if (editable != null && editable.length() > 0) {if (start > 0) {editable.delete(start - 1, start);}if((editable.toString().length()==editLength-2)){isupper = false;showKeyBoardLayout(ed, INPUTTYPE_ABC, -1);}if(start == 1){isupper = false;showKeyBoardLayout(ed, INPUTTYPE_SYMBOL, -1);}}} else if (primaryCode == Keyboard.KEYCODE_SHIFT) {// 大小写切换changeKey();keyboardView.setKeyboard(abcKeyboard);} else if (primaryCode == Keyboard.KEYCODE_DONE) {// 完成 and 下一个if (keyboardView.getRightType() == 4) {hideKeyboardLayout();if (inputOver != null)inputOver.inputHasOver(keyboardView.getRightType(), ed);} else if (keyboardView.getRightType() == 5) {// 下一个监听if (inputOver != null)inputOver.inputHasOver(keyboardView.getRightType(), ed);}} else if (primaryCode == 0) {// 空白键}else if (primaryCode == 456456) {//转换字母键盘isupper = false;if((editable.toString().length()>=editLength-1)){showKeyBoardLayout(ed, INPUTTYPE_ABC_LAST, -1);}else{showKeyBoardLayout(ed, INPUTTYPE_ABC, -1);}} else if (primaryCode == 789789) {//转换字符省键盘isupper = false;showKeyBoardLayout(ed, INPUTTYPE_SYMBOL, -1);} else {// 判断如果有好几个字符,输入省份就修改第一个字符if(start>0 && inputType==INPUTTYPE_SYMBOL){// 有输入的文字 并且当前切换到了省份 输入汉字 修改第一个字符// editable.insert(0, Character.toString((char) primaryCode));if(primaryCode == -1110){// 武警的车牌 WJ 的字符 WJ 87 74if(!ed.getText().toString().startsWith("WJ")){editable.replace(0,1,Character.toString((char) 87));editable.insert(1,Character.toString((char) 74));}}else{if(ed.getText().toString().startsWith("WJ")){editable.replace(0,1,Character.toString((char) primaryCode));editable.delete(1,2);}else{editable.replace(0,1,Character.toString((char) primaryCode));}}return ;}else{if(editable.toString().length()>=editLength){// 最大车牌数量return ;}if(primaryCode == -1110){// 武警的车牌 WJ 的字符 WJ 87 74editable.insert(0,Character.toString((char) 87));editable.insert(1,Character.toString((char) 74));}else{editable.insert(start, Character.toString((char) primaryCode));}}if(editable.toString().length()==editLength-1){showKeyBoardLayout(ed, INPUTTYPE_ABC_LAST, -1);}// 判断第一个字符是否是中文,是,则自动切换到数字软键盘if (ed.getText().toString().matches(reg) || ed.getText().toString().equals("WJ")) {showKeyBoardLayout(ed, INPUTTYPE_ABC, -1);}if(ed.getText().toString().startsWith("WJ")){// WJ 开头的车是武警的车 位数8位setEditLength(PLATE_NEW_ENERGY_LENGTH);}else{setEditType(editType);}}}};/*** 键盘大小写切换*/private void changeKey() {List<Key> keylist = abcKeyboard.getKeys();if (isupper) {// 大写切小写isupper = false;for (Key key : keylist) {if (key.label != null && isword(key.label.toString())) {key.label = key.label.toString().toLowerCase();key.codes[0] = key.codes[0] + 32;}}} else {// 小写切大写isupper = true;for (Key key : keylist) {if (key.label != null && isword(key.label.toString())) {key.label = key.label.toString().toUpperCase();key.codes[0] = key.codes[0] - 32;}}}}public void showKeyboard() {if (keyboardView != null) {keyboardView.setVisibility(View.GONE);}initInputType();isShow = true;keyboardView.setVisibility(View.VISIBLE);}private void initKeyBoard(int keyBoardViewID) {mActivity = (Activity) mContext;if (inflaterView != null) {keyboardView = (PpKeyBoardView) inflaterView.findViewById(keyBoardViewID);} else {keyboardView = (PpKeyBoardView) mActivity.findViewById(keyBoardViewID);}keyboardView.setEnabled(true);keyboardView.setOnKeyboardActionListener(listener);keyboardView.setOnTouchListener(new View.OnTouchListener() {@Overridepublic boolean onTouch(View v, MotionEvent event) {if (event.getAction() == MotionEvent.ACTION_MOVE) {return true;}return false;}});}private Key getCodes(int i) {return keyboardView.getKeyboard().getKeys().get(i);}private void initInputType() {
// if (inputType == INPUTTYPE_NUM) {
// // isnum = true;
// initKeyBoard(R.id.keyboard_view);
// keyboardView.setPreviewEnabled(false);
// numKeyboard = new Keyboard(mContext, R.xml.symbols);
// setMyKeyBoard(numKeyboard);
// } else if (inputType == INPUTTYPE_NUM_FINISH) {
// initKeyBoard(R.id.keyboard_view);
// keyboardView.setPreviewEnabled(false);
// numKeyboard = new Keyboard(mContext, R.xml.symbols_finish);
// setMyKeyBoard(numKeyboard);
// }// else if (inputType == INPUTTYPE_NUM_POINT) {
// initKeyBoard(R.id.keyboard_view);
// keyboardView.setPreviewEnabled(false);
// numKeyboard = new Keyboard(mContext, R.xml.symbols_point);
// setMyKeyBoard(numKeyboard);
// }// else if (inputType == INPUTTYPE_NUM_X) {
// initKeyBoard(R.id.keyboard_view);
// keyboardView.setPreviewEnabled(false);
// numKeyboard = new Keyboard(mContext, R.xml.symbols_x);
// setMyKeyBoard(numKeyboard);
// }
// else if (inputType == INPUTTYPE_NUM_NEXT) {
// initKeyBoard(R.id.keyboard_view);
// keyboardView.setPreviewEnabled(false);
// numKeyboard = new Keyboard(mContext, R.xml.symbols_next);
// setMyKeyBoard(numKeyboard);
// }if (inputType == INPUTTYPE_ABC) {// isnum = false;initKeyBoard(R.id.keyboard_view_abc_sym);keyboardView.setPreviewEnabled(true);abcKeyboard = new Keyboard(mContext, R.xml.symbols_abc);setMyKeyBoard(abcKeyboard);} else if (inputType == INPUTTYPE_SYMBOL) {initKeyBoard(R.id.keyboard_view_abc_sym);keyboardView.setPreviewEnabled(true);symbolKeyboard = new Keyboard(mContext, R.xml.symbols_symbol);setMyKeyBoard(symbolKeyboard);}else if(inputType == INPUTTYPE_ABC_LAST){initKeyBoard(R.id.keyboard_view_abc_sym);keyboardView.setPreviewEnabled(true);abcKeyboardLast = new Keyboard(mContext, R.xml.symbols_abc_last);setMyKeyBoard(abcKeyboardLast);}
// else if (inputType == INPUTTYPE_NUM_ABC) {
// initKeyBoard(R.id.keyboard_view);
// keyboardView.setPreviewEnabled(false);
// numKeyboard = new Keyboard(mContext, R.xml.symbols_num_abc);
// setMyKeyBoard(numKeyboard);
// }}private void setMyKeyBoard(Keyboard newkeyboard) {keyboard = newkeyboard;keyboardView.setKeyboard(newkeyboard);}//新的隐藏方法public void hideKeyboardLayout() {if (getKeyboardState() == true) {if (keyBoardLayout != null)keyBoardLayout.setVisibility(View.GONE);if (keyBoardStateChangeListener != null)keyBoardStateChangeListener.KeyBoardStateChange(KEYBOARD_HIDE, ed);isShow = false;hideKeyboard();ed = null;}}/*** @param editText* @param keyBoardType 类型* @param scrollTo 滑动到某个位置,可以是大于等于0的数,其他数不滑动*///新的show方法public void showKeyBoardLayout(final EditText editText, int keyBoardType, int scrollTo) {if (editText.equals(ed) && getKeyboardState() == true && this.inputType == keyBoardType)return;this.inputType = keyBoardType;this.scrollTo = scrollTo;//TODOif (keyBoardLayout != null && keyBoardLayout.getVisibility() == View.VISIBLE)Log.d("KeyboardUtil", "visible");if (setKeyBoardCursorNew(editText)) {showHandler = new Handler();showHandler.postDelayed(new Runnable() {@Overridepublic void run() {show(editText);}}, 400);} else {//直接显示show(editText);}}private void show(EditText editText) {this.ed = editText;if (keyBoardLayout != null)keyBoardLayout.setVisibility(View.VISIBLE);showKeyboard();if (keyBoardStateChangeListener != null)keyBoardStateChangeListener.KeyBoardStateChange(KEYBOARD_SHOW, editText);//用于滑动if (scrollTo >= 0) {keyBoardScroll(editText, scrollTo);}}private void hideKeyboard() {isShow = false;if (keyboardView != null) {int visibility = keyboardView.getVisibility();if (visibility == View.VISIBLE) {keyboardView.setVisibility(View.INVISIBLE);}}if (layoutView != null) {layoutView.setVisibility(View.GONE);}}private boolean isword(String str) {String wordstr = "abcdefghijklmnopqrstuvwxyz";if (wordstr.indexOf(str.toLowerCase()) > -1) {return true;}return false;}/*** @description:TODO 输入监听*/public interface InputFinishListener {public void inputHasOver(int onclickType, EditText editText);}/*** 监听键盘变化*/public interface KeyBoardStateChangeListener {public void KeyBoardStateChange(int state, EditText editText);}public void setKeyBoardStateChangeListener(KeyBoardStateChangeListener listener) {this.keyBoardStateChangeListener = listener;}}
然后就是xml的键盘:
省份的xml,普通字符的xml,和最后一位包含汉字的xml
<?xml version="1.0" encoding="UTF-8"?>
<Keyboardandroid:keyWidth="9.5%p"android:keyHeight="6.4%p"android:horizontalGap="1.2%p"android:verticalGap="1.55%p"xmlns:android="http://schemas.android.com/apk/res/android"><Row android:verticalGap="1%p"><Key android:codes="20140" android:keyLabel="京"android:horizontalGap="0.41%p" android:keyWidth="9.5%p"android:keyEdgeFlags="left" /><Key android:codes="27941" android:keyLabel="津"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="20864" android:keyLabel="冀"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="40065" android:keyLabel="鲁"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="26187" android:keyLabel="晋"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="33945" android:keyLabel="蒙"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="36797" android:keyLabel="辽"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="21513" android:keyLabel="吉"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="40657" android:keyLabel="黑"android:horizontalGap="1.71%p" android:keyWidth="9.5%p"android:keyEdgeFlags="right"/></Row><Row android:verticalGap="1%p"><Key android:codes="27818" android:keyLabel="沪"android:horizontalGap="0.41%p" android:keyWidth="9.5%p"android:keyEdgeFlags="left"/><Key android:codes="33487" android:keyLabel="苏"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="27993" android:keyLabel="浙"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="30358" android:keyLabel="皖"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="38397" android:keyLabel="闽"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="36195" android:keyLabel="赣"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="35947" android:keyLabel="豫"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="37122" android:keyLabel="鄂"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="28248" android:keyLabel="湘"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" android:keyEdgeFlags="right" /></Row><Row android:verticalGap="1%p"><Key android:codes="26690" android:keyLabel="桂" android:keyEdgeFlags="left"android:horizontalGap="0.41%p" android:keyWidth="9.5%p"/><Key android:codes="28189" android:keyLabel="渝"android:horizontalGap="1.71%p" android:keyWidth="9.5%p"/><Key android:codes="31908" android:keyLabel="粤"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="24029" android:keyLabel="川"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="36149" android:keyLabel="贵"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="20113" android:keyLabel="云"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="34255" android:keyLabel="藏"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="38485" android:keyLabel="陕"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /><Key android:codes="29976" android:keyLabel="甘" android:keyEdgeFlags="right"android:horizontalGap="1.71%p" android:keyWidth="9.5%p" /></Row><Row ><Key android:codes="456456"android:keyEdgeFlags="left" android:keyLabel="@string/char_abc"android:horizontalGap="0.41%p" android:keyWidth="14.7%p"android:isModifier="true" android:isSticky="true" /><Key android:codes="38738" android:keyLabel="青"android:horizontalGap="0.41%p" android:keyWidth="9.5%p"/><Key android:codes="29756" android:keyLabel="琼"android:horizontalGap="0.41%p" android:keyWidth="9.5%p" /><Key android:codes="26032" android:keyLabel="新"android:horizontalGap="0.41%p" android:keyWidth="9.5%p"/><Key android:codes="23425" android:keyLabel="宁"android:horizontalGap="0.41%p" android:keyWidth="9.5%p" /><Key android:codes="21488" android:keyLabel="台"android:horizontalGap="0.41%p" android:keyWidth="9.5%p"/><Key android:codes="20351" android:keyLabel="使"android:horizontalGap="0.41%p" android:keyWidth="9.5%p"/><Key android:codes="-1110" android:keyLabel="WJ"android:horizontalGap="0.41%p" android:keyWidth="9.5%p"/><Key android:codes="-5" android:horizontalGap="0.41%p" android:keyWidth="14.7%p"android:keyEdgeFlags="right" android:isRepeatable="false" /><!-- <Key android:codes="-3" android:isRepeatable="false" android:horizontalGap="2%p" android:keyWidth="13%p" android:keyEdgeFlags="right"/>--></Row></Keyboard>
<?xml version="1.0" encoding="UTF-8"?>
<Keyboard android:keyWidth="9.5%p"android:keyHeight="6.4%p"android:horizontalGap="1.2%p"android:verticalGap="1.55%p"xmlns:android="http://schemas.android.com/apk/res/android"><Row android:verticalGap="1%p"><Key android:codes="49" android:keyLabel="1"android:horizontalGap="0.25%p" android:keyWidth="9.5%p"android:keyEdgeFlags="left" /><Key android:codes="50" android:keyLabel="2"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="51" android:keyLabel="3"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="52" android:keyLabel="4"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="53" android:keyLabel="5"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="54" android:keyLabel="6"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="55" android:keyLabel="7"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="56" android:keyLabel="8"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="57" android:keyLabel="9"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="48" android:keyLabel="0"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"android:keyEdgeFlags="right"/></Row><Row android:verticalGap="1%p"><Key android:codes="81" android:keyLabel="Q"android:horizontalGap="0.25%p" android:keyWidth="9.5%p"android:keyEdgeFlags="left" /><Key android:codes="87" android:keyLabel="W"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="69" android:keyLabel="E"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="82" android:keyLabel="R"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="84" android:keyLabel="T"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="89" android:keyLabel="Y"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="85" android:keyLabel="U"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><!-- <Key android:codes="73" android:keyLabel="I"android:horizontalGap="2%p" android:keyWidth="8%p" />--><Key android:codes="49" android:keyLabel="I"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><!-- <Key android:codes="79" android:keyLabel="O"android:horizontalGap="2%p" android:keyWidth="8%p" />--><Key android:codes="48" android:keyLabel="O"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="80" android:keyLabel="P"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"android:keyEdgeFlags="right" /></Row><Row android:verticalGap="1%p"><Key android:codes="65" android:keyLabel="A"android:horizontalGap="5.25%p" android:keyWidth="9.5%p"android:keyEdgeFlags="left"/><Key android:codes="83" android:keyLabel="S"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="68" android:keyLabel="D"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="70" android:keyLabel="F"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="71" android:keyLabel="G"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="72" android:keyLabel="H"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="74" android:keyLabel="J"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="75" android:keyLabel="K"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="76" android:keyLabel="L"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"android:keyEdgeFlags="right" /></Row><Row ><Key android:codes="789789"android:keyEdgeFlags="left" android:keyLabel="省份"android:horizontalGap="0.25%p" android:keyWidth="14.5%p"android:isModifier="true" android:isSticky="true" /><Key android:codes="90" android:keyLabel="Z"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"/><Key android:codes="88" android:keyLabel="X"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="67" android:keyLabel="C"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="86" android:keyLabel="V"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="66" android:keyLabel="B"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="78" android:keyLabel="N"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"/><Key android:codes="77" android:keyLabel="M"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"/><Key android:keyWidth="14.5%p" android:codes="-5" android:horizontalGap="0.5%p"android:keyEdgeFlags="right" android:isRepeatable="false"/></Row></Keyboard>
<?xml version="1.0" encoding="UTF-8"?>
<Keyboard android:keyWidth="9.5%p"android:keyHeight="6.4%p"android:horizontalGap="1.2%p"android:verticalGap="1.55%p"xmlns:android="http://schemas.android.com/apk/res/android"><Row android:verticalGap="1%p"><Key android:codes="49" android:keyLabel="1"android:horizontalGap="0.25%p" android:keyWidth="9.5%p"android:keyEdgeFlags="left" /><Key android:codes="50" android:keyLabel="2"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="51" android:keyLabel="3"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="52" android:keyLabel="4"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="53" android:keyLabel="5"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="54" android:keyLabel="6"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="55" android:keyLabel="7"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="56" android:keyLabel="8"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="57" android:keyLabel="9"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="48" android:keyLabel="0"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"android:keyEdgeFlags="right"/></Row><Row android:verticalGap="1%p"><Key android:codes="81" android:keyLabel="Q"android:horizontalGap="0.25%p" android:keyWidth="9.5%p"android:keyEdgeFlags="left" /><Key android:codes="87" android:keyLabel="W"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="69" android:keyLabel="E"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="82" android:keyLabel="R"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="84" android:keyLabel="T"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="89" android:keyLabel="Y"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="85" android:keyLabel="U"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><!-- <Key android:codes="73" android:keyLabel="I"android:horizontalGap="2%p" android:keyWidth="8%p" />--><Key android:codes="49" android:keyLabel="I"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><!-- <Key android:codes="79" android:keyLabel="O"android:horizontalGap="2%p" android:keyWidth="8%p" />--><Key android:codes="48" android:keyLabel="O"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="80" android:keyLabel="P"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"android:keyEdgeFlags="right" /></Row><Row android:verticalGap="1%p"><Key android:codes="65" android:keyLabel="A"android:horizontalGap="5.25%p" android:keyWidth="9.5%p"android:keyEdgeFlags="left"/><Key android:codes="83" android:keyLabel="S"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="68" android:keyLabel="D"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="70" android:keyLabel="F"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="71" android:keyLabel="G"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="72" android:keyLabel="H"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="74" android:keyLabel="J"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="75" android:keyLabel="K"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="76" android:keyLabel="L"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"android:keyEdgeFlags="right" /></Row><Row android:verticalGap="1%p"><Key android:codes="90" android:keyLabel="Z" android:keyEdgeFlags="left"android:horizontalGap="10.25%p" android:keyWidth="9.5%p"/><Key android:codes="88" android:keyLabel="X"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="67" android:keyLabel="C"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="86" android:keyLabel="V"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="66" android:keyLabel="B"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="78" android:keyLabel="N"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"/><Key android:codes="77" android:keyLabel="M"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"/><Key android:codes="35686" android:keyLabel="警" android:keyEdgeFlags="right"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"/></Row><Row ><Key android:codes="789789"android:keyEdgeFlags="left" android:keyLabel="省份"android:horizontalGap="0.25%p" android:keyWidth="14.5%p"android:isModifier="true" android:isSticky="true" /><Key android:codes="23398" android:keyLabel="学"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"/><Key android:codes="25346" android:keyLabel="挂"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="36229" android:keyLabel="超"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="20351" android:keyLabel="使"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="39046" android:keyLabel="领"android:horizontalGap="0.5%p" android:keyWidth="9.5%p" /><Key android:codes="28207" android:keyLabel="港"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"/><Key android:codes="28595" android:keyLabel="澳"android:horizontalGap="0.5%p" android:keyWidth="9.5%p"/><Key android:keyWidth="14.5%p" android:codes="-5" android:horizontalGap="0.5%p"android:keyEdgeFlags="right" android:isRepeatable="false"/></Row></Keyboard>
然后是在MainActivity中的简单使用:
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;import com.ziyeyouhu.library.KeyboardTouchListener;
import com.ziyeyouhu.library.KeyboardUtil;public class MainActivity extends AppCompatActivity {private RelativeLayout rootView;private ScrollView scrollView;private EditText normalEd;private EditText specialEd;private KeyboardUtil keyboardUtil;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);rootView = (RelativeLayout) findViewById(R.id.root_view);// scrollView = (ScrollView) findViewById(R.id.sv_main);normalEd = (EditText) findViewById(R.id.normal_ed);specialEd = (EditText) findViewById(R.id.special_ed);initMoveKeyBoard();}@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) {if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 ) {if(keyboardUtil.isShow){keyboardUtil.hideSystemKeyBoard();keyboardUtil.hideAllKeyBoard();keyboardUtil.hideKeyboardLayout();}else {return super.onKeyDown(keyCode, event);}return false;} elsereturn super.onKeyDown(keyCode, event);}private void initMoveKeyBoard() {keyboardUtil = new KeyboardUtil(this, rootView, scrollView);keyboardUtil.setOtherEdittext(normalEd);// 车牌位数 普通车7位 新能源车8位keyboardUtil.setEditType(0);// monitor the KeyBarod statekeyboardUtil.setKeyBoardStateChangeListener(new KeyBoardStateListener());// monitor the finish or next KeykeyboardUtil.setInputOverListener(new inputOverListener());specialEd.setOnTouchListener(new KeyboardTouchListener(keyboardUtil, KeyboardUtil.INPUTTYPE_SYMBOL, -1));}class KeyBoardStateListener implements KeyboardUtil.KeyBoardStateChangeListener {@Overridepublic void KeyBoardStateChange(int state, EditText editText) {System.out.println("state" + state);System.out.println("editText" + editText.getText().toString());}}class inputOverListener implements KeyboardUtil.InputFinishListener {@Overridepublic void inputHasOver(int onclickType, EditText editText) {System.out.println("onclickType" + onclickType);System.out.println("editText" + editText.getText().toString());}}}
4.相关属性
android:keyBackground=”@drawable/selector_key”
* 按键的背景颜色
android:shadowColor=”#FFFFFF”
android:shadowRadius=”0.0”
* 不加这两个属性 文字会出现模糊
android:keyTextColor=”#000”
* 字体颜色
android:keyTextSize=”18sp”
* 字体大小
android:keyIcon=”@drawable/ic_delete”
* 按键上的图标
android:codes=”20140”
* 输出的内容 对照ASCII表
android:keyLabel=”京”
* 按键上显示的内容
android:horizontalGap=”0px”
* 水平方向的间隙
android:verticalGap=”0px”
* 垂直反向的间隙
android:keyEdgeFlags=”right”
* 按键的对齐方式
下面是代码下载地址:https://download.csdn.net/download/u010833696/10842425
欢迎大家下载,不好意思 我实在没用积分了 ,所以就要了积分,大脚见谅
android 车牌输入键盘相关推荐
- android 车牌键盘,支持新能源,警车,军车,领事馆车,特种车辆(源代码)
最近在android项目中,遇到需要android车牌键盘的需求(需要支持普通车牌,新能源,警车,军车,领事馆车,教练车以及特种车辆等车牌) 一.示例图 话不多说,分享一下android车牌键盘效果图 ...
- android表情输入键盘,GitHub - UKfire/Emotion: 帮你的Android应用快速集成表情键盘
##Emotion 帮你快速集成Android表情键盘,让你的应用不止文字,让表情跳动起来 ##It looks Cool ##Usage Download ZIP,然后解压,将emoji包添加到自己 ...
- 识别车牌号码demo php,Android车牌识别 Demo 源码 能识别蓝色和黄色车牌的OCR android版本...
[实例简介] 文字描述:一,开发环境 jse eclipse(Kepler,32bit),jdk 1.6.0 _45(32bit),adt 23.0.6,支持Android SDK版本区间为8~19( ...
- 基于vue开发的,车牌输入专用键盘, vue车牌输入键盘,vue车牌输入 vue-license-keyboard
没办法,在项目中要求车牌输入的键盘要专门使用一个车牌输入的软键盘 项目地址:https://github.com/langyuxiansheng/vue-license-keyboard 最近重新写了 ...
- Android 检测输入键盘是否弹起
博客为 有时个哥 原创,如需转载请标明出处:https://blog.csdn.net/ls703/article/details/80609869 在公司开发SDK时,有这么一个需求,要检测集成我们 ...
- 安卓Android、iOS移动端车牌识别OCR技术原理
核心内容:移动端车牌识别.安卓端车牌识别.Android车牌识别.iOS端车牌识别.OCR识别技术 一.安卓Android.iOS移动端车牌识别OCR技术识别流程 安卓Android.iOS移动端车牌 ...
- PDA车牌识别/手持机车牌识别SDK—应用处理
核心技术:Android车牌识别.ios车牌识别 本地离线识别可保存车牌号码.方便,快捷,精准提高前端人员工作效率.增强C端用户产品体验价值. 目前,不仅是军用项目会用到PDA,很多民用项目使用PDA ...
- 车牌识别OCRSDK
随着社会的发展,人们越来越注重自己的财产安全问题,随之而然,保险行业中的车险行业的竞争愈发激烈,如何采取有效的手段提高工作效率.提升客户满意度.进而提高核心竞争力,成为各大保险公司关注的焦点.而在车险 ...
- 2022-09-06 Android输入法顶起输入框,遮挡RecyclerView
背景 IM项目中的会话界面,一般就是顶部一个标题,底部是输入区域,中间显示消息列表. 微信的会话界面中,进入会话界面,有以下几点: 隐藏输入法 当消息数量能占满屏幕时,底部显示最后一条,依次往上排列 ...
- 【uniapp前端组件】自定义车牌键盘
自定义车牌输入键盘–车牌键盘 简介 本组件根据自定义万能键盘(数字键盘.身份证键盘.带小数点数字键盘.车牌键盘)升级而来,老组件代码有点看不懂了,哈哈哈哈.另外数字键盘.身份证键盘.小数点数字键盘un ...
最新文章
- 线程了解以及创建线程的Threading模块中的部分方法
- 自动化测试之鼠标悬浮操作、双击、鼠标拖拽
- springboot 实现微信小程序授权并解密手机号
- boost::hana::at_c用法的测试程序
- mongod启动问题
- (19)Xilinx PCIE中断理论(学无止境)
- jave类命名_Java重命名文件– Jave移动文件
- 密码学加解密实训(墨者学院摩斯密码第2题)
- js对象深拷贝的简单实现
- hive:窗口函数/开窗函数 OVER()(笔记)
- treegrid 的使用介绍
- Serenity Screenplay模式
- getchar()作用
- STM32F767多通道ADC采集+DMA传输
- Matlab应变片仿真,应变片传感器的应用.ppt
- 【Python】利用百度地图API获取多方式行程时间
- PDF文件怎么在线压缩?教你在线压缩的方法
- pygame小游戏框架
- linux系统内存used占用过高问题排查
- 差分隐私:原理,应用与展望