LoginSignup
4
4

More than 5 years have passed since last update.

Titanium Alloy WebView表示時に初期状態で表示されているキーボードを非表示にする

Last updated at Posted at 2014-05-13

Titaniumを試してみているところで躓いたのでメモ。

Titanium SDK 3.2.3 の場合、WebViewを表示すると初期状態でキーボードが表示されていた。
これを非表示にする。

メモ

  • iPhoneエミュレータでは表示されていなかったが、Androidだと表示されていた。
  • キーボードの左右移動ボタンで画面が左右にスクロールしていたので、PCでブラウザを使っている際のキーボードのような動きをするのかなと思った。
  • Titanium SDKを 3.2.2.GA に落としてみたら表示されなくなった。

対策

これを追加

webview.softKeyboardOnFocus = Ti.UI.Android.SOFT_KEYBOARD_HIDE_ON_FOCUS;

※コメントより、対策を教えて頂きました!

念のためソース

app/controllers/index.js

var window  = Titanium.UI.createWindow({
    navBarHidden: true,
});

var webview = Ti.UI.createWebView({
    url: 'http://MyWebSite/',
    // width: Titanium.Platform.displayCaps.platformWidth,
    // height: Titanium.Platform.displayCaps.platformHeight,
    width: "100%",
    height: "100%",
    enableZoomControls: false,
    disableBounce: true
});

// コレを追加
webview.softKeyboardOnFocus = Ti.UI.Android.SOFT_KEYBOARD_HIDE_ON_FOCUS;

window.add(webview);
window.open();
4
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4