Dismiss SoftKeyboard in Flex Mobile

血红的双手。 提交于 2020-01-25 12:23:56

问题


The Flex InteractiveObject has has a requestSoftKeyboard() method that pops up the Soft Keyboard.

How can I do the opposite and send it back?

Thank you.


回答1:


With Flex 4.6, you can dismiss by setting

stage.focus = null;

Please read more here: open soft keyboard in a mobile Flex application




回答2:


For example, say your InteractiveObject is a TextInput, then you can keep it from popping up with the following:

private function onActivating(event:SoftKeyboardEvent):void 
{
           event.preventDefault();
}           


<s:TextInput softKeyboardActivating="onActivating(event)" />

Or you can use

<s:TextInput needsSoftKeyboard = "False"/>

EDIT:

You can send it back with the following:

Listen for the event when you want it to close (like hitting the "enter" key) and then use the setFocus property to change the focus to another component:

private function CloseKeyboard():void
{
hidesoftkeyboard.setFocus();
}`

<s:TextInput id="txtinput"/>
<s:Button id="hidesoftkeyboard" click=CloseKeyboard();>

UPDATE

Following the 4.6 update to Flex - there are new softkeyboard techniques chronicled here.



来源:https://stackoverflow.com/questions/7231457/dismiss-softkeyboard-in-flex-mobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!