編輯:關於android開發
actionNone : 回車鍵,按下後光標到下一行
actionGo : Go,
actionSearch : 放大鏡
actionSend : Send
actionNext : Next
actionDone : Done,確定/完成,隱藏軟鍵盤,即使不是最後一個文本輸入框
android:singleline="true"
android:imeoptions="actionSearch"
EditText.setOnEditorActionListener設置監聽
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean isOK = true;
switch (actionId) {
case EditorInfo.IME_ACTION_NONE:
Toast.makeText(mContext, "點擊-->NONE", Toast.LENGTH_SHORT).show();
break;
case EditorInfo.IME_ACTION_GO:
Toast.makeText(mContext, "點擊-->GO", Toast.LENGTH_SHORT).show();
break;
case EditorInfo.IME_ACTION_SEARCH:
Toast.makeText(mContext, "點擊-->SEARCH", Toast.LENGTH_SHORT).show();
break;
case EditorInfo.IME_ACTION_SEND:
Toast.makeText(mContext, "點擊-->SEND", Toast.LENGTH_SHORT).show();
break;
case EditorInfo.IME_ACTION_NEXT:
Toast.makeText(mContext, "點擊-->NEXT", Toast.LENGTH_SHORT).show();
break;
default:
isOK = false;
break;
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.edwin.demokeyboard.MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:text="改變軟鍵盤右下角確定鍵樣式"
android:textSize="20sp" />
<EditText
android:id="@+id/et_main_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="actionGo"
android:imeOptions="actionGo"
android:singleLine="true" />
<EditText
android:id="@+id/et_main_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="actionSearch"
android:imeOptions="actionSearch"
android:singleLine="true" />
<EditText
android:id="@+id/et_main_three"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="actionSend"
android:imeOptions="actionSend"
android:singleLine="true" />
<EditText
android:id="@+id/et_main_four"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="actionNext"
android:imeOptions="actionNext"
android:singleLine="true" />
</LinearLayout>

源碼地址:
Android音頻開發之基礎知識介紹
Android音頻開發之基礎知識介紹 先來點閒言碎語,前段時間我有一段感悟:Android開發,本身並不是一個可以走得多遠的方向,它只是一個平台,提供了許多封裝好的A
Android Studio下載安裝使用教程,androidstudio
Android Studio下載安裝使用教程,androidstudio最近Google的在Google I/O大會上推出了一款新的開發工具android studio。
安卓開發學習經歷2--《第一行代碼》coolweather項目SQL語句同一個“陷阱”掉兩次 注意轉義字符等特殊字符正確書寫 關於Id字段自增加體會,coolweather
安卓開發學習經歷2--《第一行代碼》coolweather項目SQL語句同一個“陷阱”掉兩次 注意轉義字符等特殊字符正確書寫 關於Id字段自增加體會,coolweath
MSM8909+Android5.1.1鍵盤驅動---sn7326介紹
MSM8909+Android5.1.1鍵盤驅動---sn7326介紹 1.Sn7326概述 SN7326是一款帶智能自掃描的鍵盤擴展芯片,支持多達8*8個按鍵。按下