WebViewでセレクトボックスが動作しない

1,818 views
Skip to first unread message

そうめい

unread,
Aug 23, 2012, 10:39:11 PM8/23/12
to android-g...@googlegroups.com
みなさま

お世話になります。

HTMLのセレクトボックス(<select>タグ)が、Web
Viewで動作しないという現象が発生して困ってます。
ボックスをタップしても、選択肢が表示されません。

たまに表示されることもありますが、選択後の動作も反応しません。

同じページを標準ブラウザで開くと、セレクトボックスは問題なく動作します。

いまのところ不具合が出てるのは、
 Galaxy Nexus(4.0)
 SHARP SH09D(4.0)
 docomo ARROWS Tab LTE F-01D xi(3.2)
だけです。

2.x 端末は大丈夫のようです。


どなたか、同じような現象にあった方いませんでしょうか? 
何か心当たりのある方、アドバイスいただけますと幸いです。

よろしくお願いいたします。
 

そうめい

unread,
Aug 24, 2012, 7:04:26 AM8/24/12
to android-g...@googlegroups.com
みなさま

お世話になります。自己レスです。

セレクトボックスをタップした際に、Logcatには

08-24 19:58:10.318: W/InputManagerService(195): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@41c88b58

というのが表示されます。


これは、同じページを標準ブラウザで開いて正常に動作するときも出ているので
関係ないとは思っておりますが・・・・。

何かヒントでもありましたら
ご教授いただけますと幸いです。

よろしくお願いいたします。


2012年8月24日金曜日 11時39分11秒 UTC+9 そうめい:

そうめい

unread,
Aug 26, 2012, 5:10:21 AM8/26/12
to android-g...@googlegroups.com
すみません、たびたび自己レスです。

原因(というか悪さをしてる部分)がわかりました。

該当アプリではTabHostを使用していまして
その中にWebViewを配置しているのですが
この配置の仕方が良くないようです。

試しにTabHostをLinearLayoutに変更してみたところ
セレクトボックスが動作するようになりました。

この配置の仕方って、NGなんでしょうかね・・・


できればTabHostを使用したままで正常動作させたいと思いますので
かなりレアケースかと思いますが
「こうしてみたら?」みたいなアドバイスありましたら
引き続きよろしくお願いいたしますm(_ _)m



2012年8月24日金曜日 20時04分26秒 UTC+9 そうめい:

Stone Guan

unread,
Feb 11, 2014, 3:14:50 AM2/11/14
to android-g...@googlegroups.com
Make a subclass of TabHost, and override dispatchWindowFocusChanged that makes webview clear focus.
This class will make your html select work, but the "Window already focused, ignoring focus gain of" log will be left.

public class CustomeTabHost extends TabHost {

    public CustomeTabHost(final Context context, final AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomeTabHost(final Context context) {
        this(context, null);
    }

    

    @Override
    public void dispatchWindowFocusChanged(final boolean paramBoolean)
    {
        
        // focusedView should be webview
        View focusedView = ((Activity)getContext()).getCurrentFocus();
        
        if (focusedView != null) {
            focusedView.clearFocus();
        }
        
        if (getCurrentView() == null) {
            return;
        }
        super.dispatchWindowFocusChanged(paramBoolean);
    }
}

在 2012年8月24日星期五UTC+9上午11时39分11秒,そうめい写道:
Reply all
Reply to author
Forward
0 new messages