- 浏览: 580257 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (338)
- 已过时文章(留念用) (39)
- Android学习笔记 (30)
- Android开发指引自译 (100)
- Android NDK文档自译 (23)
- Android设计指引自译 (2)
- xp(ペケピー)&linux(理奈、铃)酱~ (4)
- ui酱&歌词自译~ (9)
- lua酱~ (9)
- 自我反省 (1)
- 羽game计划 (1)
- XSL酱 (2)
- java酱 (3)
- 设计的领悟 (58)
- 涂鸦作品(pixiv) (1)
- ruby酱 (2)
- Objective-C编程语言自译 (2)
- Android开发月报 (6)
- objc酱 (2)
- photoshop (3)
- js酱 (6)
- cpp酱 (8)
- antlr酱 (7)
- Lua 5.1参考手册自译 (11)
- 收藏品 (3)
- 待宵草计划 (4)
- 体验版截图 (1)
最新评论
-
naruto60:
太给力了!!!!我这网打不开Intel官网,多亏楼主贴了连接, ...
使用HAXM加速的Android x86模拟器(和一些问题) -
yangyile2011:
谢谢博主,翻译得很好哦
【翻译】(4)片段 -
ggwang:
牙痛的彼岸:痹!
牙痛的彼岸 -
ggwang:
总结得很简练清晰啊,学习了!
ANTLR学习笔记一:概念理解 -
leisurelife1990:
mk sdd
用git下载Android自带app的源代码
【翻译】(14)输入事件
see
http://developer.android.com/guide/topics/ui/ui-events.html
原文见
http://developer.android.com/guide/topics/ui/ui-events.html
-------------------------------
Input Events
输入事件
-------------------------------
In this document
本文目录
* Event Listeners 事件监听器
* Event Handlers 事件句柄
* Touch Mode 触碰模式
* Handling Focus 处理焦点
Related tutorials
相关教程
Form Stuff 表单材料
(注:此文并没有提及类android.view.GestureDetector的使用,它可以通过接管onTouch
public boolean onTouch(View v, MotionEvent event) {
return detector.onTouchEvent(event);
}
来监听更复杂的手势
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
Log.i("MyGesture", "onFling");
}
)
-------------------------------
On Android, there's more than one way to intercept the events from a user's interaction with your application. When considering events within your user interface, the approach is to capture the events from the specific View object that the user interacts with. The View class provides the means to do so.
在Android上,有多于一种方法拦截用户与你的应用程序交互的事件。当感兴趣的事件发生在你的用户界面时,方法是从指定与用户交互的View对象中捕获事件。View类提供一些方法来做到这一点。
Within the various View classes that you'll use to compose your layout, you may notice several public callback methods that look useful for UI events. These methods are called by the Android framework when the respective action occurs on that object. For instance, when a View (such as a Button) is touched, the onTouchEvent() method is called on that object. However, in order to intercept this, you must extend the class and override the method. However, extending every View object in order to handle such an event would not be practical. This is why the View class also contains a collection of nested interfaces with callbacks that you can much more easily define. These interfaces, called event listeners, are your ticket to capturing the user interaction with your UI.
在你用来组合你的布局的不同View类中,你可能会注意到几个公共的回调方法,看起来对于用户界面事件有用。当相应的动作发生在那个对象上时,这些方法被Android框架调用。例如,当一个View(诸如一个Button)被触碰时,onTouchEvent()方法被调用在那个对象上。然而为了拦截这个事件,你必须扩展这个类并覆盖这个方法。然而,扩展每个View对象以处理该事件是不切实际的。因此View类还包含一系列带回调的内嵌接口类,你可以更容易地定义它们。这些接口类,称为事件监听器,是你捕获用户与你的用户界面交互的关键。
While you will more commonly use the event listeners to listen for user interaction, there may come a time when you do want to extend a View class, in order to build a custom component. Perhaps you want to extend the Button class to make something more fancy. In this case, you'll be able to define the default event behaviors for your class using the class event handlers.
虽然你将更通常地使用事件监听器来监听用户交互,但是可能有时候你希望扩展一个View类,以构建一个自定义组件。可能你希望扩展Button类以使某些东西变得更棒。在这种情况下,你可以使用类事件句柄为你的类定义默认事件行为。
-------------------------------
Event Listeners
事件监听器
An event listener is an interface in the View class that contains a single callback method. These methods will be called by the Android framework when the View to which the listener has been registered is triggered by user interaction with the item in the UI.
事件监听器是View类的接口类,包含单一回调方法。当已经注册了监听器的View被用户与用户界面中条目的交互触发时,这些方法被Android框架调用。
Included in the event listener interfaces are the following callback methods:
包含在事件监听器接口类中的回调方法如下所示:
* onClick()
From View.OnClickListener. This is called when the user either touches the item (when in touch mode), or focuses upon the item with the navigation-keys or trackball and presses the suitable "enter" key or presses down on the trackball.
来自View.OnClickListener。此回调在用户触碰条目(触碰模式下),或用导航键或轨迹球把焦点移到条目上并按下合适的“进入”键或按下轨迹球时被调用。
* onLongClick()
From View.OnLongClickListener. This is called when the user either touches and holds the item (when in touch mode), or focuses upon the item with the navigation-keys or trackball and presses and holds the suitable "enter" key or presses and holds down on the trackball (for one second).
来自View.OnLongClickListener。此回调在用户触碰并按住该条目(触碰模式下),或用导航键或轨迹球把焦点移到条目上并按下和按住合适的“进入”键或按下并按住轨迹球(持续一秒)时被调用。
* onFocusChange()
From View.OnFocusChangeListener. This is called when the user navigates onto or away from the item, using the navigation-keys or trackball.
来自View.OnFocusChangeListener。此回调在用户使用导航键或轨迹球导航进入或离开条目时被调用。
* onKey()
From View.OnKeyListener. This is called when the user is focused on the item and presses or releases a key on the device.
来自View.OnKeyListener。它在用户焦点移进条目并在设备上按下或释放按键时被调用。
* onTouch()
From View.OnTouchListener. This is called when the user performs an action qualified as a touch event, including a press, a release, or any movement gesture on the screen (within the bounds of the item).
来自View.OnTouchListener。此回调在用户执行一个被认为是触碰事件的动作时被调用,包括在屏幕上按下,释放,或任意移动手势(在该条目的范围内)。
* onCreateContextMenu()
From View.OnCreateContextMenuListener. This is called when a Context Menu is being built (as the result of a sustained "long click"). See the discussion on context menus in the Menus developer guide.
来自View.OnCreateContextMenuListener。此回调在一个上下文菜单被构建(作为持续“长点击”的结果)时被调用。参见菜单开发者指引中关于上下文菜单的讨论。
These methods are the sole inhabitants of their respective interface. To define one of these methods and handle your events, implement the nested interface in your Activity or define it as an anonymous class. Then, pass an instance of your implementation to the respective View.set...Listener() method. (E.g., call setOnClickListener() and pass it your implementation of the OnClickListener.)
这些方法是它们对应接口类的唯一寄居物。为了定义这些方法中的一个并处理你的事件,请在你的Activity中实现嵌套接口或定义它作为一个匿名类。然后传递你的实现的一个实例给相应的View.set...Listener()方法。(例如,调用setOnClickListener()并把你的OnClickListener的实现传递给它。)
The example below shows how to register an on-click listener for a Button.
下面的例子展示如何注册一个Button对象的点击监听器。
-------------------------------
// Create an anonymous implementation of OnClickListener
// 创建OnClickListener的匿名实现
private OnClickListener mCorkyListener = new OnClickListener() {
public void onClick(View v) {
// do something when the button is clicked
// 在按钮点击时执行一些操作
}
};
protected void onCreate(Bundle savedValues) {
...
// Capture our button from layout
// 从布局中取出我们的按钮
Button button = (Button)findViewById(R.id.corky);
// Register the onClick listener with the implementation above
// 注册上面实现的onClick监听器
button.setOnClickListener(mCorkyListener);
...
}
-------------------------------
You may also find it more convenient to implement OnClickListener as a part of your Activity. This will avoid the extra class load and object allocation. For example:
你还可以发现实现OnClickListener作为你的Activity类的一部分会更为便利。这样将避免额外的类加载和对象分配。例如:
-------------------------------
public class ExampleActivity extends Activity implements OnClickListener {
protected void onCreate(Bundle savedValues) {
...
Button button = (Button)findViewById(R.id.corky);
button.setOnClickListener(this);
}
// Implement the OnClickListener callback
// 实现OnClickListener回调
public void onClick(View v) {
// do something when the button is clicked
// 在按钮点击时执行一些操作
}
...
}
-------------------------------
Notice that the onClick() callback in the above example has no return value, but some other event listener methods must return a boolean. The reason depends on the event. For the few that do, here's why:
注意上面实例代码中的onClick()回调没有返回值,但其他一些事件监听器方法必须返回一个布尔值。理由依赖于事件。对于少数要这样做的情况,理由是:
* onLongClick() - This returns a boolean to indicate whether you have consumed the event and it should not be carried further. That is, return true to indicate that you have handled the event and it should stop here; return false if you have not handled it and/or the event should continue to any other on-click listeners.
* onLongClick() - 此回调返回布尔值以指出你是否已经消耗事件而它是否应该搬运得更远。具体来说,返回true指示你已经处理事件而它应该在这里停止;返回false,如果你还没有处理它和/或事件应该继续传给其它任意点击监听器。
* onKey() - This returns a boolean to indicate whether you have consumed the event and it should not be carried further. That is, return true to indicate that you have handled the event and it should stop here; return false if you have not handled it and/or the event should continue to any other on-key listeners.
* onKey() - 此回调返回一个布尔值指示你是否已经消耗事件,并且它不应该被搬运到更远。具体来说,返回true表示你已经处理事件而它应该在这里停止;返回false,如果你还没有处理它和/或事件应该继续传给其他任意的键盘按下监听器。
* onTouch() - This returns a boolean to indicate whether your listener consumes this event. The important thing is that this event can have multiple actions that follow each other. So, if you return false when the down action event is received, you indicate that you have not consumed the event and are also not interested in subsequent actions from this event. Thus, you will not be called for any other actions within the event, such as a finger gesture, or the eventual up action event.
* onTouch() - 此回调返回一个布尔值指示你的监听器是否消耗此事件。重要的事情是此事件可以拥有多个互相跟随的动作。所以,如果当按下动作事件接收时你返回false,那么你表示你还没有消耗该事件,并且不关心这个事件随后的动作。这样,你将不会因为这个事件中的其他任意动作而被调用,诸如手指动作,或最终的向上动作事件。
Remember that key events are always delivered to the View currently in focus. They are dispatched starting from the top of the View hierarchy, and then down, until they reach the appropriate destination. If your View (or a child of your View) currently has focus, then you can see the event travel through the dispatchKeyEvent() method. As an alternative to capturing key events through your View, you can also receive all of the events inside your Activity with onKeyDown() and onKeyUp().
记住键盘事件总是被传递给当前获取焦点的View。它们从View层级的顶部开始被派发,然后向下,直至它们到达合适的目标。如果你的视图(或你的视图的子对象)当前拥有焦点,那么你可以看到事件通过dispatchKeyEvent()方法传播。作为通过你的View捕获键盘事件的替换方案,你还可以在你的Activity中用onKeyDown()和onKeyUp()接收所有事件。
-------------------------------
Note: Android will call event handlers first and then the appropriate default handlers from the class definition second. As such, returning true from these event listeners will stop the propagation of the event to other event listeners and will also block the callback to the default event handler in the View. So be certain that you want to terminate the event when you return true.
注意:Android将首先调用事件句柄然后第二步才从类定义中调用合适的默认句柄。因此,从这些事件监听器中返回true将阻止事件传播给其它事件监听器并且还将阻塞对View中默认事件句柄的回调。所以请肯定当你返回true时你想终止事件。
-------------------------------
Event Handlers
事件句柄
If you're building a custom component from View, then you'll be able to define several callback methods used as default event handlers. In the document about Custom Components, you'll learn see some of the common callbacks used for event handling, including:
如果你正在从View中构建一个自定义组件,那么你将可以定义几个用作默认事件句柄的回调方法。在关于自定义组件的文档中,你将看到一些通常用于事件处理的回调,包括:
* onKeyDown(int, KeyEvent) - Called when a new key event occurs.
* onKeyDown(int, KeyEvent) - 当新的按键事件发生时被调用。
* onKeyUp(int, KeyEvent) - Called when a key up event occurs.
* onKeyUp(int, KeyEvent) - 当一个按键弹起事件发生时被调用。
* onTrackballEvent(MotionEvent) - Called when a trackball motion event occurs.
* onTrackballEvent(MotionEvent) - 当轨迹球动作事件发生时被调用。
* onTouchEvent(MotionEvent) - Called when a touch screen motion event occurs.
* onTouchEvent(MotionEvent) - 当一个触碰屏幕动作事件发生时被调用。
* onFocusChanged(boolean, int, Rect) - Called when the view gains or loses focus.
* onFocusChanged(boolean, int, Rect) - 当视图获取或失去焦点时被调用。
There are some other methods that you should be aware of, which are not part of the View class, but can directly impact the way you're able to handle events. So, when managing more complex events inside a layout, consider these other methods:
你应该意识到其它几个方法,它们不是View类的一部分,但可以直接影响你能处理事件的方式。所以,当管理布局中更复杂事件时,请考虑其它这些方法:
* Activity.dispatchTouchEvent(MotionEvent) - This allows your Activity to intercept all touch events before they are dispatched to the window.
* Activity.dispatchTouchEvent(MotionEvent) - 此回调允许在所有触碰事件被派发到窗口之前,你的Activity拦截它们。
* ViewGroup.onInterceptTouchEvent(MotionEvent) - This allows a ViewGroup to watch events as they are dispatched to child Views.
* ViewGroup.onInterceptTouchEvent(MotionEvent) - 此回调允许一个ViewGroup在事件被派发到子视图时监视它们。
* ViewParent.requestDisallowInterceptTouchEvent(boolean) - Call this upon a parent View to indicate that it should not intercept touch events with onInterceptTouchEvent(MotionEvent).
* ViewParent.requestDisallowInterceptTouchEvent(boolean) - 在父View上调用此回调以指示它不应该用onInterceptTouchEvent(MotionEvent)拦截触碰事件。
-------------------------------
Touch Mode
触碰模式
When a user is navigating a user interface with directional keys or a trackball, it is necessary to give focus to actionable items (like buttons) so the user can see what will accept input. If the device has touch capabilities, however, and the user begins interacting with the interface by touching it, then it is no longer necessary to highlight items, or give focus to a particular View. Thus, there is a mode for interaction named "touch mode."
当用户正在用方向键或轨迹球导航用户界面时,需要把焦点交给可活动的条目(如按钮),这样用户可以看到接收输入的是什么。然而,如果设备拥有触碰功能,而用户通过触碰它开始与界面交互,那么它不再需要高亮条目,或把焦点交给一个特定的View。因此,存在一种被称为“触碰模式”的交互模式。
For a touch-capable device, once the user touches the screen, the device will enter touch mode. From this point onward, only Views for which isFocusableInTouchMode() is true will be focusable, such as text editing widgets. Other Views that are touchable, like buttons, will not take focus when touched; they will simply fire their on-click listeners when pressed.
对于可捕获触碰的设备来说,一旦用户触碰屏幕,设备将进入触碰模式。从这一点开始,只有isFocusableInTouchMode()是true的View将是可获取焦点的,诸如文本编辑部件。其它可触碰的View,如按钮,在触碰时将不会获取焦点;它们简单地在按下时发送事件到它们的点击监听器。
Any time a user hits a directional key or scrolls with a trackball, the device will exit touch mode, and find a view to take focus. Now, the user may resume interacting with the user interface without touching the screen.
任何时候一个用户碰到一个方向键或用轨迹球滚动,设备都将推出触碰模式,并且寻找视图获取焦点。现在,用户可以恢复与用户界面的交互而不需要触碰屏幕。
The touch mode state is maintained throughout the entire system (all windows and activities). To query the current state, you can call isInTouchMode() to see whether the device is currently in touch mode.
触碰模式状态由整个系统维护(所有窗口和活动)。为了查询当前状态,你可以定义isInTouchMode()看看设备现在是否处于触碰模式中。
-------------------------------
Handling Focus
处理焦点
The framework will handle routine focus movement in response to user input. This includes changing the focus as Views are removed or hidden, or as new Views become available. Views indicate their willingness to take focus through the isFocusable() method. To change whether a View can take focus, call setFocusable(). When in touch mode, you may query whether a View allows focus with isFocusableInTouchMode(). You can change this with setFocusableInTouchMode().
框架将处理路由焦点移动以响应用户的输入。它包括当View被移除或隐藏时改变焦点,或当新的View变得可用时。View通过isFocusable()方法指示它们获取焦点的意愿。为了改变一个View是否可以获取焦点,可以调用setFocusable()。当在触碰模式下,你可以用isFocusableInTouchMode()查询一个View是否允许获取焦点。你可以用setFocusableInTouchMode()改变它。
Focus movement is based on an algorithm which finds the nearest neighbor in a given direction. In rare cases, the default algorithm may not match the intended behavior of the developer. In these situations, you can provide explicit overrides with the following XML attributes in the layout file: nextFocusDown, nextFocusLeft, nextFocusRight, and nextFocusUp. Add one of these attributes to the View from which the focus is leaving. Define the value of the attribute to be the id of the View to which focus should be given. For example:
焦点移动是基于一种算法,它查找给定方向上的最近邻居。在很少情况下,默认算法可能不匹配开发者的期待的行为。在这些情况下,你可以用以下布局文件的XML属性提供显式的覆盖:nextFocusDown,nextFocusLeft,nextFocusRight,和nextFocusUp。添加这些属性的其中一个到焦点要离开的View。定义属性的值为将要给予焦点的View的id。例如:
-------------------------------
<LinearLayout
android:orientation="vertical"
... >
<Button android:id="@+id/top"
android:nextFocusUp="@+id/bottom"
... />
<Button android:id="@+id/bottom"
android:nextFocusDown="@+id/top"
... />
</LinearLayout>
-------------------------------
Ordinarily, in this vertical layout, navigating up from the first Button would not go anywhere, nor would navigating down from the second Button. Now that the top Button has defined the bottom one as the nextFocusUp (and vice versa), the navigation focus will cycle from top-to-bottom and bottom-to-top.
通常,在这个垂直布局中,从第一个Button向上导航将不会跑到其他地方,从第二个Button开始向下导航也不会这样。现在,顶部Button已经定义为底部Button的nextFocusUp(等等),导航焦点将循环地从上到下和从下到上。
If you'd like to declare a View as focusable in your UI (when it is traditionally not), add the android:focusable XML attribute to the View, in your layout declaration. Set the value true. You can also declare a View as focusable while in Touch Mode with android:focusableInTouchMode.
如果你喜欢声明View在你的用户界面中是可获取焦点的(当它传统上不可以),可以在布局声明中添加android:focusable的XML属性到那个View。设置值为true。你还可以用android:focusableInTouchMode声明一个View在触碰模式下是可获取焦点的,
To request a particular View to take focus, call requestFocus().
为了要求特定View对象获取焦点,请调用requestFocus()。
To listen for focus events (be notified when a View receives or looses focus), use onFocusChange(), as discussed in the Event Listeners section, above.
为了监听焦点事件(当一个View接收或失去焦点时被通知),使用onFocusChange(),正如上面在事件监听器章节中讨论的那样。
Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License.
除特别说明外,本文在Apache 2.0下许可。细节和限制请参考内容许可证。
Android 4.0 r1 - 17 Nov 2011 21:59
Site Terms of Service - Privacy Policy - Brand Guidelines
-------------------------------
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
(此页部分内容基于Android开源项目,以及使用根据创作公共2.5来源许可证描述的条款进行修改)
发表评论
-
【翻译】(9-补丁2)电话簿提供者
2012-07-18 12:54 2400【翻译】(9-补丁2)电话簿提供者 see h ... -
【翻译】(8-补丁1)Android接口定义语言(AIDL)
2012-07-02 05:55 2927【翻译】(8-补丁1)Andro ... -
【翻译】(0)应用组件
2012-06-30 23:50 829【翻译】(0)应用组件 see http:// ... -
【翻译】(88)传感器
2012-05-21 21:25 1077【翻译】(88)传感器 ... -
【翻译】(87)复制与粘贴
2012-05-20 14:48 1929【翻译】(87)复制与粘贴 see http: ... -
【翻译】(86)音频捕捉
2012-05-16 15:14 1104【翻译】(86)音频捕捉 ... -
【翻译】(85)照相机
2012-05-13 15:09 3796【翻译】(85)照相机 see http:// ... -
【翻译】(84)JetPlayer
2012-04-21 16:24 981【翻译】(84)JetPlayer see h ... -
【翻译】(83)媒体回放
2012-04-21 16:00 1860【翻译】(83)媒体回放 see http:/ ... -
【翻译】(82)多媒体与照相机
2012-04-18 23:05 953【翻译】(82)多媒体与照相机 see htt ... -
【翻译】(23-补丁3)构建无障碍服务
2012-04-18 21:57 1627【翻译】(23-补丁3)构 ... -
【翻译】(23-补丁2)使应用程序无障碍
2012-04-16 13:08 2099【翻译】(23-补丁2)使应用程序无障碍 see ... -
【翻译】(23-补丁1)无障碍
2012-04-11 22:38 911【翻译】(23-补丁1)无 ... -
【翻译】(81)Renderscript之运行时API参考手册
2012-04-11 22:13 1416【翻译】(81)Renderscript之运行时API参 ... -
【翻译】(80)Renderscript之计算
2012-04-09 14:09 1444【翻译】(80)Renderscript之计算 ... -
【翻译】(79)Renderscript之图形
2012-04-08 13:59 2866【翻译】(79)Renderscript之图形 ... -
【翻译】(78)Renderscript
2012-04-04 15:35 1442【翻译】(78)Renderscript see ... -
【翻译】(77)可绘画对象动画
2012-03-18 10:52 711【翻译】(77)可绘画对象动画 see htt ... -
【翻译】(76)视图动画
2012-03-18 10:04 806【翻译】(76)视图动画 see http:/ ... -
【翻译】(75)属性动画
2012-03-17 18:24 2508【翻译】(75)属性动画 see http:/ ...
相关推荐
WMT14(Workshop on Statistical Machine Translation 2014)是自然语言处理领域的一个重要事件,专注于统计机器翻译(Statistical Machine Translation, SMT)。该数据集是为2014年ACL(Association for ...
Get from value 模块可以检索页面上所有输入字段的名称、类型和值,这使得攻击者可以轻松地获取目标网站的表单信息。 5. Get local storage(获取本地存储): Get local storage 模块可以从 HTML5 localStorage ...
1. `getGameAction(int keyCode)`:将硬件按键编码映射到游戏操作常量,便于处理游戏输入。 2. `getKeyCode(int gameAction)`:与`getGameAction()`相反,它将游戏操作常量转换回按键编码。 3. `getKeyName(int ...
4. **表单验证**:ASP.NET提供了内置的验证控件,如RequiredFieldValidator、RegularExpressionValidator等,用于确保用户输入的数据满足预设条件。 5. **数据绑定**:ASP.NET支持多种数据绑定方式,如DataSource...
#### 14. `onblur` - **定义**:在对象失去输入焦点时触发。 - **应用场景**:可以用来检查表单字段是否填写正确,或者保存输入框的内容。 #### 15. `onbounce` - **定义**:当marquee对象的behavior属性设置为...
14. **OnSetFocus** 和 **OnKillFocus**:分别处理对话框获取和失去焦点的事件。 15. **OnActivate** 和 **OnDeactivate**:对话框激活和停用的处理函数。 16. **OnGetMinMaxInfo**:提供对话框最小和最大尺寸信息。...
7. **复杂事件处理(CEP)**:Drools Fusion是Drools中用于复杂事件处理的模块,支持事件的时序分析和模式识别,该部分涉及了复杂事件处理的基本概念、Drools Fusion、事件语义、事件处理模式、会话时钟、滑动窗口、...
《Android中文API合集》是为初学者提供的一份宝贵资源,由Android中文翻译组精心编译而成。这个合集旨在帮助那些对Android开发感兴趣但英语基础较弱的开发者更好地理解和应用Android API。尽管对于有一定基础的...
【Android中文翻译组android.widget合集】是一个针对Android开发者的宝贵资源集合,主要涵盖了`android.widget`包中的组件和相关知识点。这个合集包括了电子书、源代码和其他相关文档,帮助开发者深入理解和掌握...
14. AlertDialog:对话框,用于弹出临时窗口,显示警告、确认或输入信息。 15. Toast:轻提示,显示短暂的文本信息,不会阻断用户操作。 16. ArrayAdapter:适配器类,用于将数据绑定到ListView、GridView等视图组件...
14. command substitution 命令替换,使得可以捕获一个命令的输出而在另一个命令中替换它 命令替换是一个bash功能,提供了命令的输出捕获和替换功能。它可以在shell脚本中被使用,用于实现命令的自动化。 15. ...
【channel翻译】指的是在计算机图形学、游戏开发和软件编程领域中,"channel"一词的翻译和理解。"Channel"在不同的上下文中有多种含义,通常与数据传输、信号处理或系统通信有关。以下是一些相关的专业术语及其详细...
6. **事件驱动编程**:VB采用事件驱动模型,当用户与界面元素交互时,如点击按钮或输入数据,对应的事件会被触发并执行相应的代码。 7. **业务逻辑处理**:在后台,VB代码处理业务逻辑,如验证输入数据的合法性、...
Asterisk的拨号计划由一系列命令组成,这些命令用于定义呼叫流程并决定如何处理不同类型的呼叫事件。以下是一些主要的Asterisk Dialplan命令的中文翻译和详细说明: 1. Authenticate:此命令用于验证用户身份,通常...
Panappticon通过跟踪事件处理程序、异步调用接口和跨进程通信,建立了用户输入与显示结果之间的因果关系,无论这些事件发生在用户层还是内核层。系统还记录资源使用情况,如上下文切换、网络和存储设备的阻塞,以...
2. 能够通过参考时钟索引进行事件分配,易于实现一致性测量。 3. 支持简单的脉冲宽度测量。 4. 高采样率带来的高效率。 5. 最高数据吞吐速率为70MSPS。 6. 拥有高精度和单发分辨率(20psrms),同时提供高分辨率选项...
了解如何处理键盘、鼠标和其他输入事件,以及自定义事件,对于构建交互式用户界面至关重要。 3. **模型/视图架构**:这是一个强大的设计模式,允许数据和视图之间的解耦。在Qt中,你可以创建可复用的数据模型,然后...
10. **On_WM_KEYDOWN()** 和 **On_WM_KEYUP()** - 处理键盘按键按下和释放事件:用于响应用户的键盘输入。 11. **On_WM_TIMER()** - 处理定时器消息:当设置的定时器触发时,这个函数被调用,常用于实现周期性的...
12. **翻译**:输入“翻译”加需要翻译的文本,Google会显示翻译结果。 13. **股票查询**:输入股票代码,可以查看最新的股票价格和走势。 14. **时间查询**:输入“时间”加地点,会显示该地区的当前时间。 15. ...