【发布时间】:2011-04-06 15:15:48
【问题描述】:
我有一个简单的 WebView 示例应用,其布局如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- This file is /res/layout/main.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText android:id="@+id/urlToLoad"
android:hint="Type url to load"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<Button android:id="@+id/webviewgo"
android:text="Go"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false" />
<com.example.exWebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
它按预期工作,但我对将键盘事件路由到 WebView 感兴趣。目前,即使我选择 WebView(和滚动等),当我键入任何键时,它都会转到 EditText 控件......这不是我想要的。
如何将键盘事件改为转到 WebView?
【问题讨论】:
标签: android keyboard keyboard-events