Appceleartor - 单击TableView行时阻止Android键盘出现

时间:2014-05-18 20:53:30

标签: android appcelerator appcelerator-mobile titanium-alloy

我正在使用Appcelerator Alloy构建应用程序,并且无法弄清楚当我单击TableView行时是否阻止Android键盘出现 - 或者当结果$.myWindow.open()事件触发时。

这是我的Alloy XML:

<Alloy>
<TabGroup title="Testing">
    <Tab title="News">
        <Window id="newsWindow" class="container" title="News">
            <TableView id="tableView"/>
        </Window>
    </Tab>
    <Tab title="Photos">
        <Window class="container" title="Photos">
            <Label>Testing</Label>
        </Window>
    </Tab>
</TabGroup>

以下是注入TableView的行的XML:

<Alloy>
<TableViewRow id="rowView">
    <ImageView id="image"/>
    <View id="postView" layout="vertical">
        <Label id="articleLabel"/>
        <Label id="articleDetails"/>
    </View>
</TableViewRow>

,这是单击Row时触发的代码。

$.tableView.addEventListener('click',function(e){
var postView = Alloy.createController('postView', e.row.args).getView();
if (OS_IOS)
{ $.navGroupWin.openWindow(postView); }
if (OS_ANDROID)
{
    postView.open();
}

});

2 个答案:

答案 0 :(得分:0)

这可能是您正在寻找的(在api doc中)

softKeyboardOnFocus : Number
Determines keyboard behavior when this view is focused.

One of Titanium.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, Titanium.UI.Android.SOFT_KEYBOARD_HIDE_ON_FOCUS, or Titanium.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS.

Default: Titanium.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS

答案 1 :(得分:0)

试试这个

  

如果(OS_Android)

     

Ti.UI.Android.hideSoftKeyboard();