【SoftKeyboard研究系列】Keyboard.Key研究

本文详细探讨了Android中Keyboard.Key类的用途、属性和方法,包括codes、horizontalGap、iconPreview等XML属性,以及isInside()、onPressed()等公共方法。通过源码分析,深入理解软键盘键位的实现机制。
摘要由CSDN通过智能技术生成

一、Keyboard.Key doc位置

本地:%ANDROID_HOME%/sdk/docs/reference/android/inputmethodservice/Keyboard.Key.html

Web:

二、Keyboard.Key doc内容

Keyboard.Key

extends  Object
java.lang.Object
   ↳ android.inputmethodservice.Keyboard.Key

Class Overview


Class for describing the position and characteristics of a single key in the keyboard.

Summary


XML Attributes
Attribute Name Related Method Description
android:codes   The unicode value or comma-separated values that this key outputs. 
android:horizontalGap   Default horizontal gap between keys. 
android:iconPreview   The icon to show in the popup preview. 
android:isModifier   Whether this is a modifier key such as Alt or Shift. 
android:isRepeatable   Whether long-pressing on this key will make it repeat. 
android:isSticky   Whether this is a toggle key. 
android:keyEdgeFlags   Key edge flags. 
android:keyHeight   Default height of a key, in pixels or percentage of display width. 
android:keyIcon   The icon to display on the key instead of the label. 
android:keyLabel   The label to display on the key. 
android:keyOutputText   The string of characters to output when this key is pressed. 
android:keyWidth   Default width of a key, in pixels or percentage of display width. 
android:popupCharacters   The characters to display in the popup keyboard. 
android:popupKeyboard   The XML keyboard layout of any popup keyboard. 
Fields
public int[] codes All the key codes (unicode or custom code) that this key could generate, zero'th being the most important.
public int edgeFlags Flags that specify the anchoring to edges of the keyboard for detecting touch events that are just out of the boundary of the key.
public int gap The horizontal gap before this key
public int height Height of the key, not including the gap
public  Drawable icon Icon to display instead of a label.
public  Drawable iconPreview Preview version of the icon, for the preview popup
public  CharSequence label Label to display
public boolean modifier Whether this is a modifier key, such as Shift or Alt
public boolean on If this is a sticky key, is it on?
public  CharSequence popupCharacters Popup characters
public int popupResId If this key pops up a mini keyboard, this is the resource id for the XML layout for that keyboard.
public boolean pressed The current pressed state of this key
public boolean repeatable Whether this key repeats itself when held down
public boolean sticky Whether this key is sticky, i.e., a toggle key
public  CharSequence
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值