android实现自定义软键盘,先上图看效果,效果基本上是仿ios输入法实现的

这里是实现隐藏系统输入法,同时让EditText能获取光标的代码部分(通过反射调用):

<span style="font-size:18px;">keyBoardLabel = (EditText) rootView.findViewById(R.id.wifi_key_input_edittext);// this.getActivity()// .getWindow()// .setSoftInputMode(// WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);try {Class<EditText> cls = EditText.class;Method setShowSoftInputOnFocus;setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus",boolean.class);setShowSoftInputOnFocus.setAccessible(true);setShowSoftInputOnFocus.invoke(keyBoardLabel, false);} catch (Exception e) {e.printStackTrace();}</span>

先看XML文件:   这里使用到了ViewStub,为了不用一次性加载 过多的布局文件资源.ViewStub能更省内存!!

<span style="font-size:18px;"><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="320dp"android:layout_height="320dp"android:background="@drawable/wifi_key_bg"android:clickable="true"android:gravity="center_horizontal"android:orientation="vertical" ><ImageViewandroid:id="@+id/wifi_keyboard_exit"style="@style/Exit"android:src="@drawable/wifi_key_return" /><!-- keyboard view --><LinearLayoutandroid:layout_width="320dp"android:layout_height="0dp"android:layout_weight="1"android:orientation="vertical"android:paddingLeft="29dp"android:paddingRight="29dp" ><!-- keyboard top --><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="2dp"android:gravity="center"android:paddingBottom="3dp" ><ImageButtonandroid:id="@+id/wifi_key_lpage_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_lpage" /><EditTextandroid:id="@+id/wifi_key_input_edittext"android:layout_width="150dp"android:layout_height="wrap_content"android:layout_marginLeft="5dp"android:layout_marginRight="5dp"android:background="@drawable/wifi_key_edit_bg"android:gravity="center"android:singleLine="true"android:text=""android:textCursorDrawable="@drawable/edittext_cursor" /><ImageButtonandroid:id="@+id/wifi_key_rpage_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_rpage" /></LinearLayout><!-- true key board include other layout --><ViewStubandroid:id="@+id/key_board_input_lower_viewstub"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout="@layout/key_board_lower_layout"android:paddingBottom="3dp"android:visibility="gone" /><ViewStubandroid:id="@+id/key_board_input_upper_viewstub"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout="@layout/key_board_upper_layout"android:paddingBottom="3dp"android:visibility="gone" /><ViewStubandroid:id="@+id/key_board_input_number_viewstub"android:layout_width="wrap_content"android:layout_height="wrap_content"android:inflatedId="@+id/inflatedStart"android:layout="@layout/key_board_number"android:paddingBottom="3dp"android:visibility="gone" /><ViewStubandroid:id="@+id/key_board_input_symbol1_viewstub"android:layout_width="wrap_content"android:layout_height="wrap_content"android:inflatedId="@+id/inflatedStart"android:layout="@layout/key_board_symbol_1"android:paddingBottom="3dp"android:visibility="gone" /><ViewStubandroid:id="@+id/key_board_input_symbol2_viewstub"android:layout_width="wrap_content"android:layout_height="wrap_content"android:inflatedId="@+id/inflatedStart"android:layout="@layout/key_board_symbol_2"android:paddingBottom="3dp"android:visibility="gone" /></LinearLayout><!-- bottom change and delete --><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="-3dp" ><ImageButtonandroid:id="@+id/wifi_key_board_delete_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_delete" /><ImageButtonandroid:id="@+id/wifi_key_board_connect_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="1dp"android:background="@drawable/wifi_key_connect" /></LinearLayout></LinearLayout></span>

接着是单个键盘的的XML布局,展示一个比较多键盘的就好了.其他的都很容易实现了

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:gravity="center" ><!-- top --><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:orientation="horizontal" ><ImageButtonandroid:id="@+id/key_symbol_1_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_1" /><ImageButtonandroid:id="@+id/key_symbol_2_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_2" /><ImageButtonandroid:id="@+id/key_symbol_3_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_3" /><ImageButtonandroid:id="@+id/key_symbol_4_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_4" /><ImageButtonandroid:id="@+id/key_symbol_5_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_5" /><ImageButtonandroid:id="@+id/key_symbol_6_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_6" /><ImageButtonandroid:id="@+id/key_symbol_7_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_7" /><ImageButtonandroid:id="@+id/key_symbol_8_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_8" /><ImageButtonandroid:id="@+id/key_symbol_9_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_9" /><ImageButtonandroid:id="@+id/key_symbol_10_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_10" /></LinearLayout><!-- middle --><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:orientation="horizontal" ><ImageButtonandroid:id="@+id/key_symbol_11_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_11" /><ImageButtonandroid:id="@+id/key_symbol_12_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_12" /><ImageButtonandroid:id="@+id/key_symbol_13_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_13" /><ImageButtonandroid:id="@+id/key_symbol_14_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_14" /><ImageButtonandroid:id="@+id/key_symbol_15_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_15" /><ImageButtonandroid:id="@+id/key_symbol_16_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_16" /><ImageButtonandroid:id="@+id/key_symbol_17_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_17" /><ImageButtonandroid:id="@+id/key_symbol_18_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_18" /><ImageButtonandroid:id="@+id/key_symbol_19_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_19" /></LinearLayout><!-- bottom --><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"android:orientation="horizontal" ><ImageButtonandroid:id="@+id/key_symbol_20_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_20" /><ImageButtonandroid:id="@+id/key_symbol_21_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_21" /><ImageButtonandroid:id="@+id/key_symbol_22_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_22" /><ImageButtonandroid:id="@+id/key_symbol_23_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_23" /><ImageButtonandroid:id="@+id/key_symbol_24_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_24" /><ImageButtonandroid:id="@+id/key_symbol_25_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_25" /><ImageButtonandroid:id="@+id/key_symbol_26_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_26" /><ImageButtonandroid:id="@+id/key_symbol_27_btn"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/wifi_key_symbol_27" /></LinearLayout>
</LinearLayout>

最后是主要的代码部分,上关键代码,代码没什么注释,不过从命名一眼能看出来是什么,理解思路最重要,实现起来其实很简单,有什么疑问留言吧

package com.moco.launcher.wifi;import java.lang.reflect.Method;import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.text.InputType;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.Switch;
import android.widget.TextView;import com.moco.launcher.R;
import com.moco.launcher.activity.NewWifiSettingsActivity;
import com.oazon.common.Logger;
import com.oazon.moco.serialport.SerialControll;
import com.oazon.voicelib.service.SpeechManage;public class WifInputFragment extends Fragment implements OnClickListener {private String TAG = "WifInputFragment";private View rootView;private ConnectImpl connectImpl;private ImageView exitImg;private ViewStub lowerStub, upperStub, numberStub, symbol1Stub,symbol2Stub;private EditText keyBoardLabel;private ImageButton wifi_key_lpage_btn, wifi_key_board_delete_btn,wifi_key_rpage_btn, wifi_key_board_connect_btn;private StringBuffer mBuffer;public enum INPUT_TYPE {UPPER, LOWER, NUMBER, SYMBOL1, SYMBOL2}private INPUT_TYPE currentType;private NewWifiSettingsActivity mContext;private PopupWindow mPopupWindow;private TextView tv;public WifInputFragment(ConnectImpl impl) {connectImpl = impl;mBuffer = new StringBuffer();}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {Log.i(TAG, "enter onCreateView---------");rootView = inflater.inflate(R.layout.wifi_keyboard_layout, container,false);init();loadKeyboardStub(INPUT_TYPE.LOWER);initKeyBoardLayout();initPopupWindow();return rootView;}private void initImageBG() {if (currentType == INPUT_TYPE.LOWER) {wifi_key_lpage_btn.setBackgroundResource(R.drawable.wifi_key_point_change);wifi_key_rpage_btn.setBackgroundResource(R.drawable.wifi_key_number_change);} else if (currentType == INPUT_TYPE.NUMBER) {wifi_key_lpage_btn.setBackgroundResource(R.drawable.wifi_key_abc_change);wifi_key_rpage_btn.setBackgroundResource(R.drawable.wifi_key_symbol_change);} else if (currentType == INPUT_TYPE.SYMBOL1) {wifi_key_lpage_btn.setBackgroundResource(R.drawable.wifi_key_number_change);wifi_key_rpage_btn.setBackgroundResource(R.drawable.wifi_key_point_change);} else if (currentType == INPUT_TYPE.SYMBOL2) {wifi_key_lpage_btn.setBackgroundResource(R.drawable.wifi_key_symbol_change);wifi_key_rpage_btn.setBackgroundResource(R.drawable.wifi_key_abc_change);}}private void initPopupWindow() {tv = new TextView(mContext);tv.setTextSize(30);tv.setTextColor(Color.BLACK);tv.setGravity(Gravity.CENTER_HORIZONTAL);tv.setPadding(0, 0, 0, 50);mPopupWindow = new PopupWindow(tv, -2, -2);mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));}private void init() {mContext = (NewWifiSettingsActivity) getActivity();exitImg = (ImageView) rootView.findViewById(R.id.wifi_keyboard_exit);exitImg.setOnClickListener(this);keyBoardLabel = (EditText) rootView.findViewById(R.id.wifi_key_input_edittext);// this.getActivity()// .getWindow()// .setSoftInputMode(// WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);try {Class<EditText> cls = EditText.class;Method setShowSoftInputOnFocus;setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus",boolean.class);setShowSoftInputOnFocus.setAccessible(true);setShowSoftInputOnFocus.invoke(keyBoardLabel, false);} catch (Exception e) {e.printStackTrace();}// keyBoardLabel.setCursorVisible(true);// keyBoardLabel.requestFocus();wifi_key_lpage_btn = (ImageButton) rootView.findViewById(R.id.wifi_key_lpage_btn);wifi_key_lpage_btn.setOnClickListener(this);wifi_key_rpage_btn = (ImageButton) rootView.findViewById(R.id.wifi_key_rpage_btn);wifi_key_rpage_btn.setOnClickListener(this);wifi_key_board_connect_btn = (ImageButton) rootView.findViewById(R.id.wifi_key_board_connect_btn);wifi_key_board_connect_btn.setOnClickListener(this);wifi_key_board_delete_btn = (ImageButton) rootView.findViewById(R.id.wifi_key_board_delete_btn);wifi_key_board_delete_btn.setOnClickListener(this);wifi_key_board_delete_btn.setOnTouchListener(new KeyDeleteOnTouchListener());upperStub = (ViewStub) rootView.findViewById(R.id.key_board_input_upper_viewstub);upperStub.inflate();lowerStub = (ViewStub) rootView.findViewById(R.id.key_board_input_lower_viewstub);lowerStub.inflate();numberStub = (ViewStub) rootView.findViewById(R.id.key_board_input_number_viewstub);numberStub.inflate();symbol1Stub = (ViewStub) rootView.findViewById(R.id.key_board_input_symbol1_viewstub);symbol1Stub.inflate();symbol2Stub = (ViewStub) rootView.findViewById(R.id.key_board_input_symbol2_viewstub);symbol2Stub.inflate();}private void initKeyBoardLayout() {for (int i = 0; i < KeyBoardResource.UpperKeyBtnIds.length; i++) {ImageButton imgBtn = (ImageButton) rootView.findViewById(KeyBoardResource.UpperKeyBtnIds[i]);if (imgBtn != null)imgBtn.setOnTouchListener(new KeyImageBtnTouchListener());}for (int i = 0; i < KeyBoardResource.LowerKeyBtnIds.length; i++) {ImageButton imgBtn = (ImageButton) rootView.findViewById(KeyBoardResource.LowerKeyBtnIds[i]);if (imgBtn != null)imgBtn.setOnTouchListener(new KeyImageBtnTouchListener());}for (int i = 0; i < KeyBoardResource.NumberKeyBtnIds.length; i++) {ImageButton imgBtn = (ImageButton) rootView.findViewById(KeyBoardResource.NumberKeyBtnIds[i]);if (imgBtn != null)imgBtn.setOnTouchListener(new KeyImageBtnTouchListener());}for (int i = 0; i < KeyBoardResource.symbol1.length; i++) {ImageButton imgBtn = (ImageButton) rootView.findViewById(KeyBoardResource.symbol1[i]);if (imgBtn != null)imgBtn.setOnTouchListener(new KeyImageBtnTouchListener());}for (int i = 0; i < KeyBoardResource.symbol2.length; i++) {ImageButton imgBtn = (ImageButton) rootView.findViewById(KeyBoardResource.symbol2[i]);if (imgBtn != null)imgBtn.setOnTouchListener(new KeyImageBtnTouchListener());}}private class KeyDeleteOnTouchListener implements OnTouchListener {private long currentTimeMillis_start;private long currentTimeMillis_move = 0;int duration = 0;@Overridepublic boolean onTouch(View v, MotionEvent event) {switch (event.getAction()) {case MotionEvent.ACTION_DOWN:currentTimeMillis_start = System.currentTimeMillis();break;case MotionEvent.ACTION_MOVE:currentTimeMillis_move = System.currentTimeMillis();duration = (int) (currentTimeMillis_move - currentTimeMillis_start);if (duration > 100) {if (mBuffer != null && mBuffer.length() > 0) {mBuffer.deleteCharAt(mBuffer.length() - 1);keyBoardLabel.setText(mBuffer.toString());} else {keyBoardLabel.setText("");}currentTimeMillis_start += 100;keyBoardLabel.setSelection(mBuffer.length());}break;case MotionEvent.ACTION_UP:break;default:break;}return false;}}private class KeyImageBtnTouchListener implements OnTouchListener {private String result = "";private int id;private float moveX;private float moveY;private float startY;private float startX;private float durationX;private float durationY;@Overridepublic boolean onTouch(View v, MotionEvent event) {switch (event.getAction()) {case MotionEvent.ACTION_DOWN:id = v.getId();if (id == R.id.key_lower_change_btn) {changeUpperAndLowerBoard();return true;} else if (id == R.id.key_upper_change_btn) {changeUpperAndLowerBoard();return true;}startX = event.getRawX();startY = event.getRawY();result = KeyBoardResource.getCharById(v.getId());Log.i(TAG, "click char is:" + result);if (id == R.id.key_symbol_44_btn) {tv.setText("");tv.setBackgroundResource(R.drawable.wifi_key_board_1);} else if (id == R.id.key_symbol_51_btn) {tv.setText("");tv.setBackgroundResource(R.drawable.wifi_key_board_2);} else {tv.setText(result);tv.setBackgroundResource(R.drawable.wifi_key_board_up_bg);}if (currentType == INPUT_TYPE.NUMBER) {mPopupWindow.showAsDropDown(v, 10, -90);} else {mPopupWindow.showAsDropDown(v, -10, -90);}break;case MotionEvent.ACTION_MOVE:moveX = event.getRawX();moveY = event.getRawY();durationX = Math.abs(moveX - startX);durationY = Math.abs(moveY - startY);if (durationX > 10 || durationY > 10) {mPopupWindow.dismiss();}break;case MotionEvent.ACTION_UP:mPopupWindow.dismiss();mBuffer.append(result);Log.i(TAG, "after mBuffer char is:" + mBuffer.toString());keyBoardLabel.setText(mBuffer);keyBoardLabel.setSelection(mBuffer.length());break;default:break;}return true;}}@SuppressLint("NewApi")private void loadKeyboardStub(INPUT_TYPE type) {upperStub.setVisibility(View.GONE);lowerStub.setVisibility(View.GONE);numberStub.setVisibility(View.GONE);symbol1Stub.setVisibility(View.GONE);symbol2Stub.setVisibility(View.GONE);switch (type) {case UPPER:upperStub.setVisibility(View.VISIBLE);break;case LOWER:lowerStub.setVisibility(View.VISIBLE);break;case NUMBER:numberStub.setVisibility(View.VISIBLE);break;case SYMBOL1:symbol1Stub.setVisibility(View.VISIBLE);break;case SYMBOL2:symbol2Stub.setVisibility(View.VISIBLE);break;}currentType = type;initImageBG();}private void deleteBuffer() {Log.i(TAG, "enter deleteBuffer()");if (mBuffer != null && mBuffer.length() > 0) {mBuffer.deleteCharAt(mBuffer.length() - 1);}if (mBuffer != null && mBuffer.length() > 0) {keyBoardLabel.setText(mBuffer.toString());} else {keyBoardLabel.setText("");}keyBoardLabel.setSelection(mBuffer.length());}public void change2RightKeyBoard() {if (currentType == INPUT_TYPE.LOWER || currentType == INPUT_TYPE.UPPER)currentType = INPUT_TYPE.NUMBER;else if (currentType == INPUT_TYPE.NUMBER)currentType = INPUT_TYPE.SYMBOL1;else if (currentType == INPUT_TYPE.SYMBOL1)currentType = INPUT_TYPE.SYMBOL2;else if (currentType == INPUT_TYPE.SYMBOL2)currentType = INPUT_TYPE.LOWER;loadKeyboardStub(currentType);}public void change2LeftKeyBoard() {if (currentType == INPUT_TYPE.LOWER || currentType == INPUT_TYPE.UPPER)currentType = INPUT_TYPE.SYMBOL2;else if (currentType == INPUT_TYPE.SYMBOL2)currentType = INPUT_TYPE.SYMBOL1;else if (currentType == INPUT_TYPE.SYMBOL1)currentType = INPUT_TYPE.NUMBER;else if (currentType == INPUT_TYPE.NUMBER)currentType = INPUT_TYPE.LOWER;loadKeyboardStub(currentType);}public void changeUpperAndLowerBoard() {if (currentType == INPUT_TYPE.UPPER)loadKeyboardStub(INPUT_TYPE.LOWER);else if (currentType == INPUT_TYPE.LOWER)loadKeyboardStub(INPUT_TYPE.UPPER);loadKeyboardStub(currentType);}@Overridepublic void onClick(View v) {switch (v.getId()) {case R.id.wifi_key_lpage_btn:change2LeftKeyBoard();break;case R.id.wifi_key_rpage_btn:change2RightKeyBoard();break;case R.id.wifi_keyboard_exit:clearEditText();getActivity().onBackPressed();break;case R.id.wifi_key_board_delete_btn:deleteBuffer();break;case R.id.wifi_key_board_connect_btn:Log.i(TAG, "");if (mBuffer.toString().equals("com.moco")) {ComponentName componetName = new ComponentName("com.example.dragontest","com.example.dragontest.MainActivity");Intent intent = new Intent();intent.setComponent(componetName);startActivity(intent);android.os.Process.killProcess(android.os.Process.myPid());System.exit(0);}((NewWifiSettingsActivity) getActivity()).connect(mBuffer.toString());clearEditText();connectImpl.exit(ConnectImpl.INPUT);break;default:break;}}public void clearEditText() {mBuffer.delete(0, mBuffer.length());if (keyBoardLabel != null)keyBoardLabel.setText("");}@Overridepublic void onPause() {Logger.d(TAG, "onPause==");SerialControll.getInstance().startControl();SpeechManage.getInstance().startWake();super.onPause();}@Overridepublic void onResume() {Logger.d(TAG, "onResume==");super.onResume();SerialControll.getInstance().stopControl();SpeechManage.getInstance().stopWake();}@Overridepublic void onDestroyView() {super.onDestroyView();}@Overridepublic void onDestroy() {super.onDestroy();}@Overridepublic void onLowMemory() {Logger.d(TAG, "onLowMemory==");SerialControll.getInstance().startControl();SpeechManage.getInstance().startWake();super.onLowMemory();}
}

Android自定义软键盘输入法,隐藏系统输入法显示光标的实现相关推荐

  1. android自定义系统键盘,Android自定义软键盘

    [实例简介] Android自定义软键盘 [实例截图] [核心代码] keydemo └── keydemo ├── AndroidManifest.xml ├── bin │   ├── class ...

  2. Android 自定义软键盘实现 数字九宫格

    前言 最近项目在对接美团外卖功能 实现外面小哥凭取货码取货 对接完功能后 用户反馈 弹出的软键盘 很难输入 数字太小了 大概是下面这种显示方式 需求 组长说 要不搞一个自定义软键盘吧 数字搞大点 方便 ...

  3. Android自定义软键盘样式:字母、数字、标点三种切换

    先看效果图: 1.在需要的调用软键盘的activity_mian.xml中加入键盘控件 <!--自定义键盘控件--> <RelativeLayoutandroid:layout_wi ...

  4. android自动软键盘,Android自定义软键盘

    MyKeyboard Android自定义键盘的使用 实现步骤 第一步: 1.新建一个xml文件夹放在res目录下面,然后新建xml文件:money_keyboard.xml 2.然后在XML文件中添 ...

  5. Android 自定义软键盘实现 数字九宫格,2021年Android常见面试题目

    实现效果GIF 实现代码 自定义View 一个NineNumericKeyboardView /** Author by Lyu Date on 2021/5/26-19:55 Description ...

  6. Android 自定义软键盘实现

    module链接:https://download.csdn.net/download/meixi_android/10652565 compile project(':edlibrary') , ' ...

  7. android自定义键盘开源,Android自定义软键盘的设计与实现代码

    偶然间发现了Android.inputmethodservice.Keyboard类,即android可以自定义键盘类,做了一个简单例子供大家参考. 效果如下: 先看界面布局文件 android:la ...

  8. android 自定义软键盘

    哦然间发现了android.inputmethodservice.Keyboard类,即android可以自定义键盘类,做了一个简单例子供大家参考, 首先看看效果图: 键盘内容布局:keyconten ...

  9. Android自定义软键盘的实现

    先看界面布局文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:and ...

最新文章

  1. 【Pandas】apply,applymap和map的区别
  2. 【算法基础】常用的数据结构与算法
  3. VTK:图片之RGBToHSI
  4. django实现图片上传和显示
  5. python 日历查询系统_python 日历
  6. 中断linux命令快捷键_实用!快速操作Linux终端命令行的快捷键
  7. hadoop的ACL权限
  8. 在沈阳存款多少可以不用工作?
  9. r语言必学的十个包肖凯_家长专栏语言发育迟缓儿童的家庭训练小游戏
  10. 中兴捧月算法比赛2021 比特派 C:排队 (单调栈+二分查找)
  11. 阿里云商标注册流程是怎么样的(注册步骤详细教程)
  12. 【大白话学习】UniApp 微信小程序与APP应用 开发零基础入门教程(一)---基础页面框架搭建
  13. IDA安卓动调 模拟器手机(详细)
  14. 星空璀璨,时光流逝,分享技术,记录生活——2016年11月22日
  15. 微信小程序页面元素居中布局
  16. Round 1A 2022 - Code Jam 2022 C.Weightlifting(区间dp)
  17. 9.20-9.30面试总结
  18. 数据库中case when 的用法
  19. 最简单的Python二叉树给欧式期权定价
  20. Python排列函数和组合函数

热门文章

  1. 四核i.MX6Q和双核i.MX6DL双屏异显
  2. PHP单例模式--三私一公
  3. 控制mp3播放器中文件顺序
  4. Ubuntu下安装Koala
  5. hive以5分钟间隔处理数据
  6. ApacheCON Asia 2021清华大学软件学院王建民:工业大数据软件与开源创新
  7. 一个人没有出息的九大根源
  8. 茶余饭后:聊一聊那些神一样的程序员们 (1)
  9. java模拟摇摆小球程序代码_用java实现跳动的小球示例代码
  10. web安全(一):Web安全入门